移动端接口
This commit is contained in:
parent
54dab08194
commit
cbd027b507
@ -0,0 +1,37 @@
|
||||
package com.ktg.mes.md.controller.mobile;
|
||||
|
||||
import com.ktg.common.core.controller.BaseController;
|
||||
import com.ktg.common.core.page.TableDataInfo;
|
||||
import com.ktg.mes.md.domain.MdClient;
|
||||
import com.ktg.mes.md.service.IMdClientService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Api("客户信息")
|
||||
@RestController
|
||||
@RequestMapping("/mobile/md/client")
|
||||
public class MdClientMobController extends BaseController {
|
||||
@Autowired
|
||||
private IMdClientService mdClientService;
|
||||
|
||||
/**
|
||||
* 查询客户列表
|
||||
*/
|
||||
@ApiOperation("查询客户清单(分页)")
|
||||
@PreAuthorize("@ss.hasPermi('mes:md:client:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(MdClient mdClient)
|
||||
{
|
||||
startPage();
|
||||
List<MdClient> list = mdClientService.selectMdClientList(mdClient);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,87 @@
|
||||
package com.ktg.mes.wm.controller.mobile;
|
||||
|
||||
import com.ktg.common.annotation.Log;
|
||||
import com.ktg.common.core.controller.BaseController;
|
||||
import com.ktg.common.core.domain.AjaxResult;
|
||||
import com.ktg.common.core.page.TableDataInfo;
|
||||
import com.ktg.common.enums.BusinessType;
|
||||
import com.ktg.common.utils.poi.ExcelUtil;
|
||||
import com.ktg.mes.wm.domain.WmPackageLine;
|
||||
import com.ktg.mes.wm.service.IWmPackageLineService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
@Api("装箱单明细")
|
||||
@RestController
|
||||
@RequestMapping("/mobile/wm/packageline")
|
||||
public class WmPackageLineMobController extends BaseController {
|
||||
@Autowired
|
||||
private IWmPackageLineService wmPackageLineService;
|
||||
|
||||
/**
|
||||
* 查询装箱明细列表
|
||||
*/
|
||||
@ApiOperation("查询装箱单明细信息列表接口")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:packageline:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(WmPackageLine wmPackageLine)
|
||||
{
|
||||
startPage();
|
||||
List<WmPackageLine> list = wmPackageLineService.selectWmPackageLineList(wmPackageLine);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取装箱明细详细信息
|
||||
*/
|
||||
@ApiOperation("获取装箱单明细信息接口")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:packageline:query')")
|
||||
@GetMapping(value = "/{lineId}")
|
||||
public AjaxResult getInfo(@PathVariable("lineId") Long lineId)
|
||||
{
|
||||
return AjaxResult.success(wmPackageLineService.selectWmPackageLineByLineId(lineId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增装箱明细
|
||||
*/
|
||||
@ApiOperation("新增装箱单明细信息接口")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:packageline:add')")
|
||||
@Log(title = "装箱明细", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody WmPackageLine wmPackageLine)
|
||||
{
|
||||
return toAjax(wmPackageLineService.insertWmPackageLine(wmPackageLine));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改装箱明细
|
||||
*/
|
||||
@ApiOperation("修改装箱单明细信息接口")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:packageline:edit')")
|
||||
@Log(title = "装箱明细", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody WmPackageLine wmPackageLine)
|
||||
{
|
||||
return toAjax(wmPackageLineService.updateWmPackageLine(wmPackageLine));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除装箱明细
|
||||
*/
|
||||
@ApiOperation("删除装箱单明细")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:packageline:remove')")
|
||||
@Log(title = "装箱明细", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{lineIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] lineIds)
|
||||
{
|
||||
return toAjax(wmPackageLineService.deleteWmPackageLineByLineIds(lineIds));
|
||||
}
|
||||
}
|
@ -0,0 +1,156 @@
|
||||
package com.ktg.mes.wm.controller.mobile;
|
||||
|
||||
import com.ktg.common.annotation.Log;
|
||||
import com.ktg.common.constant.UserConstants;
|
||||
import com.ktg.common.core.controller.BaseController;
|
||||
import com.ktg.common.core.domain.AjaxResult;
|
||||
import com.ktg.common.core.page.TableDataInfo;
|
||||
import com.ktg.common.enums.BusinessType;
|
||||
import com.ktg.common.utils.StringUtils;
|
||||
import com.ktg.common.utils.poi.ExcelUtil;
|
||||
import com.ktg.mes.wm.domain.WmBarcode;
|
||||
import com.ktg.mes.wm.domain.WmPackage;
|
||||
import com.ktg.mes.wm.service.IWmBarcodeService;
|
||||
import com.ktg.mes.wm.service.IWmPackageService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
@Api("装箱单")
|
||||
@RestController
|
||||
@RequestMapping("/mobile/wm/package")
|
||||
public class WmPackageMobController extends BaseController {
|
||||
@Autowired
|
||||
private IWmPackageService wmPackageService;
|
||||
|
||||
@Autowired
|
||||
private IWmBarcodeService wmBarcodeService;
|
||||
|
||||
/**
|
||||
* 查询装箱单列表
|
||||
*/
|
||||
@ApiOperation("装箱单清单查询接口")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:package:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(WmPackage wmPackage)
|
||||
{
|
||||
startPage();
|
||||
List<WmPackage> list = wmPackageService.selectWmPackageList(wmPackage);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取装箱单详细信息
|
||||
*/
|
||||
@ApiOperation("获取装箱单详细信息接口")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:package:query')")
|
||||
@GetMapping(value = "/{packageId}")
|
||||
public AjaxResult getInfo(@PathVariable("packageId") Long packageId)
|
||||
{
|
||||
return AjaxResult.success(wmPackageService.selectWmPackageByPackageId(packageId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增装箱单
|
||||
*/
|
||||
@ApiOperation("新增装箱单基本信息接口")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:package:add')")
|
||||
@Log(title = "装箱单", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody WmPackage wmPackage)
|
||||
{
|
||||
if(UserConstants.NOT_UNIQUE.equals(wmPackageService.checkPackgeCodeUnique(wmPackage))){
|
||||
return AjaxResult.error("装箱单编号已存在!");
|
||||
}
|
||||
if(wmPackage.getParentId() !=null){
|
||||
WmPackage parentPackage = wmPackageService.selectWmPackageByPackageId(wmPackage.getParentId());
|
||||
if(StringUtils.isNotNull(parentPackage)){
|
||||
wmPackage.setAncestors(parentPackage.getAncestors()+","+parentPackage.getPackageId());
|
||||
}
|
||||
}
|
||||
|
||||
int ret =wmPackageService.insertWmPackage(wmPackage);
|
||||
|
||||
//装箱单保存成功就自动生成对应的箱条码
|
||||
WmBarcode wmBarcode = new WmBarcode();
|
||||
wmBarcode.setBussinessId(wmPackage.getPackageId());
|
||||
wmBarcode.setBussinessCode(wmPackage.getPackageCode());
|
||||
wmBarcode.setBussinessName(wmPackage.getClientName());
|
||||
wmBarcode.setBarcodeType(UserConstants.BARCODE_TYPE_PACKAGE);//类型设置为箱条码
|
||||
wmBarcode.setBarcodeFormart(UserConstants.QR_CODE);//设置为二维码
|
||||
wmBarcode.setBarcodeContent(""+UserConstants.BARCODE_TYPE_PACKAGE+"-"+wmPackage.getPackageCode());
|
||||
String path =wmBarcodeService.generateBarcode(wmBarcode);
|
||||
wmBarcode.setBarcodeUrl(path);
|
||||
wmBarcode.setCreateBy(getUsername());
|
||||
wmBarcodeService.insertWmBarcode(wmBarcode);
|
||||
|
||||
//将条码的URL更新上去
|
||||
wmPackage.setBarcodeId(wmBarcode.getBarcodeId());
|
||||
wmPackage.setBarcodeContent(wmBarcode.getBarcodeContent());
|
||||
wmPackage.setBarcodeUrl(path);
|
||||
wmPackageService.updateWmPackage(wmPackage);
|
||||
return AjaxResult.success(wmPackage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改装箱单
|
||||
*/
|
||||
@ApiOperation("修改装箱单基本信息接口")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:package:edit')")
|
||||
@Log(title = "装箱单", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody WmPackage wmPackage)
|
||||
{
|
||||
if(UserConstants.NOT_UNIQUE.equals(wmPackageService.checkPackgeCodeUnique(wmPackage))){
|
||||
return AjaxResult.error("装箱单编号已存在!");
|
||||
}
|
||||
return toAjax(wmPackageService.updateWmPackage(wmPackage));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加子箱
|
||||
*/
|
||||
@ApiOperation("装箱单添加子箱接口")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:package:edit')")
|
||||
@Log(title = "装箱单", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/addsub")
|
||||
public AjaxResult addSubPackage(@RequestBody WmPackage wmPackage){
|
||||
//不能添加自己
|
||||
if(wmPackage.getPackageId().longValue() == wmPackage.getParentId().longValue()){
|
||||
return AjaxResult.error("不能添加自己为子箱!");
|
||||
}
|
||||
|
||||
//已经有父箱的不能再次添加
|
||||
WmPackage subPackage = wmPackageService.selectWmPackageByPackageId(wmPackage.getPackageId());
|
||||
if(!"0".equals(subPackage.getAncestors())){
|
||||
return AjaxResult.error("当前子箱已经有外箱包装!");
|
||||
}
|
||||
|
||||
//更新当前子箱的父箱列表
|
||||
WmPackage parentPackage = wmPackageService.selectWmPackageByPackageId(wmPackage.getParentId());
|
||||
if(StringUtils.isNotNull(parentPackage)){
|
||||
wmPackage.setAncestors(parentPackage.getAncestors()+","+parentPackage.getPackageId());
|
||||
}
|
||||
|
||||
return toAjax(wmPackageService.updateWmPackage(wmPackage));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除装箱单
|
||||
*/
|
||||
@ApiOperation("删除装箱单接口")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:package:remove')")
|
||||
@Log(title = "装箱单", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{packageIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] packageIds)
|
||||
{
|
||||
return toAjax(wmPackageService.deleteWmPackageByPackageIds(packageIds));
|
||||
}
|
||||
}
|
@ -0,0 +1,183 @@
|
||||
package com.ktg.mes.wm.controller.mobile;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.ktg.common.annotation.Log;
|
||||
import com.ktg.common.constant.UserConstants;
|
||||
import com.ktg.common.core.controller.BaseController;
|
||||
import com.ktg.common.core.domain.AjaxResult;
|
||||
import com.ktg.common.core.page.TableDataInfo;
|
||||
import com.ktg.common.enums.BusinessType;
|
||||
import com.ktg.common.utils.StringUtils;
|
||||
import com.ktg.mes.pro.domain.ProWorkorder;
|
||||
import com.ktg.mes.pro.service.IProWorkorderService;
|
||||
import com.ktg.mes.wm.domain.*;
|
||||
import com.ktg.mes.wm.domain.tx.ProductRecptTxBean;
|
||||
import com.ktg.mes.wm.service.*;
|
||||
import com.ktg.system.strategy.AutoCodeUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Api("产品入库")
|
||||
@RestController
|
||||
@RequestMapping("/mobile/wm/productrecpt")
|
||||
public class WmProductRecptMobController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IWmProductRecptService wmProductRecptService;
|
||||
|
||||
@Autowired
|
||||
private IWmProductRecptLineService wmProductRecptLineService;
|
||||
|
||||
@Autowired
|
||||
private IStorageCoreService storageCoreService;
|
||||
|
||||
@Autowired
|
||||
private IProWorkorderService proWorkorderService;
|
||||
|
||||
@Autowired
|
||||
private AutoCodeUtil autoCodeUtil;
|
||||
|
||||
/**
|
||||
* 查询产品入库录列表
|
||||
*/
|
||||
@ApiOperation("查询产品入库单清单接口")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:productrecpt:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(WmProductRecpt wmProductRecpt)
|
||||
{
|
||||
startPage();
|
||||
List<WmProductRecpt> list = wmProductRecptService.selectWmProductRecptList(wmProductRecpt);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取产品入库录详细信息
|
||||
*/
|
||||
@ApiOperation("获取产品入库单明细信息接口")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:productrecpt:query')")
|
||||
@GetMapping(value = "/{recptId}")
|
||||
public AjaxResult getInfo(@PathVariable("recptId") Long recptId)
|
||||
{
|
||||
return AjaxResult.success(wmProductRecptService.selectWmProductRecptByRecptId(recptId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增产品入库记录
|
||||
*/
|
||||
@ApiOperation("新增产品入库单基本信息接口")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:productrecpt:add')")
|
||||
@Log(title = "产品入库记录", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody WmProductRecpt wmProductRecpt)
|
||||
{
|
||||
if(StringUtils.isNotNull(wmProductRecpt.getRecptCode())){
|
||||
if(UserConstants.NOT_UNIQUE.equals(wmProductRecptService.checkUnique(wmProductRecpt))){
|
||||
return AjaxResult.error("入库单编号已存在!");
|
||||
}
|
||||
}else {
|
||||
wmProductRecpt.setRecptCode(autoCodeUtil.genSerialCode(UserConstants.PRODUCTRECPT_CODE,""));
|
||||
}
|
||||
|
||||
|
||||
if(StringUtils.isNotNull(wmProductRecpt.getWorkorderId())){
|
||||
ProWorkorder workorder = proWorkorderService.selectProWorkorderByWorkorderId(wmProductRecpt.getWorkorderId());
|
||||
wmProductRecpt.setWorkorderCode(workorder.getWorkorderCode());
|
||||
wmProductRecpt.setWorkorderName(workorder.getWorkorderName());
|
||||
}
|
||||
|
||||
wmProductRecpt.setCreateBy(getUsername());
|
||||
wmProductRecptService.insertWmProductRecpt(wmProductRecpt);
|
||||
return AjaxResult.success(wmProductRecpt);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改产品入库录
|
||||
*/
|
||||
@ApiOperation("编辑产品入库单基本信息接口")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:productrecpt:edit')")
|
||||
@Log(title = "产品入库记录", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody WmProductRecpt wmProductRecpt)
|
||||
{
|
||||
if(UserConstants.NOT_UNIQUE.equals(wmProductRecptService.checkUnique(wmProductRecpt))){
|
||||
return AjaxResult.error("入库单编号已存在!");
|
||||
}
|
||||
|
||||
if(StringUtils.isNotNull(wmProductRecpt.getWorkorderId())){
|
||||
ProWorkorder workorder = proWorkorderService.selectProWorkorderByWorkorderId(wmProductRecpt.getWorkorderId());
|
||||
wmProductRecpt.setWorkorderCode(workorder.getWorkorderCode());
|
||||
wmProductRecpt.setWorkorderName(workorder.getWorkorderName());
|
||||
}
|
||||
|
||||
return toAjax(wmProductRecptService.updateWmProductRecpt(wmProductRecpt));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除产品入库录
|
||||
*/
|
||||
@ApiOperation("删除产品入库单接口")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:productrecpt:remove')")
|
||||
@Log(title = "产品入库记录", businessType = BusinessType.DELETE)
|
||||
@Transactional
|
||||
@DeleteMapping("/{recptIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] recptIds)
|
||||
{
|
||||
for (Long recptId: recptIds
|
||||
) {
|
||||
WmProductRecpt recpt = wmProductRecptService.selectWmProductRecptByRecptId(recptId);
|
||||
if(!UserConstants.ORDER_STATUS_PREPARE.equals(recpt.getStatus())){
|
||||
return AjaxResult.error("只能删除草稿状态的单据!");
|
||||
}
|
||||
wmProductRecptLineService.deleteByRecptId(recptId);
|
||||
}
|
||||
return toAjax(wmProductRecptService.deleteWmProductRecptByRecptIds(recptIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行入库
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("产品入库单执行入库接口")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:productrecpt:edit')")
|
||||
@Log(title = "产品入库记录", businessType = BusinessType.UPDATE)
|
||||
@Transactional
|
||||
@PutMapping("/{recptId}")
|
||||
public AjaxResult execute(@PathVariable Long recptId){
|
||||
WmProductRecpt recpt = wmProductRecptService.selectWmProductRecptByRecptId(recptId);
|
||||
|
||||
//单据有效性
|
||||
if(!StringUtils.isNotNull(recpt)){
|
||||
return AjaxResult.error("无效单据");
|
||||
}
|
||||
|
||||
//先检查单据状态
|
||||
if(UserConstants.ORDER_STATUS_FINISHED.equals(recpt.getStatus())){
|
||||
return AjaxResult.error("当前单据已提交!");
|
||||
}
|
||||
|
||||
|
||||
WmProductRecptLine param = new WmProductRecptLine();
|
||||
param.setRecptId(recptId);
|
||||
List<WmProductRecptLine> lines = wmProductRecptLineService.selectWmProductRecptLineList(param);
|
||||
if(CollUtil.isEmpty(lines)){
|
||||
return AjaxResult.error("请添加要入库的产品");
|
||||
}
|
||||
|
||||
List<ProductRecptTxBean> beans = wmProductRecptService.getTxBean(recptId);
|
||||
storageCoreService.processProductRecpt(beans);
|
||||
|
||||
recpt.setStatus(UserConstants.ORDER_STATUS_FINISHED);
|
||||
wmProductRecptService.updateWmProductRecpt(recpt);
|
||||
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,134 @@
|
||||
package com.ktg.mes.wm.controller.mobile;
|
||||
|
||||
import com.ktg.common.annotation.Log;
|
||||
import com.ktg.common.core.controller.BaseController;
|
||||
import com.ktg.common.core.domain.AjaxResult;
|
||||
import com.ktg.common.core.page.TableDataInfo;
|
||||
import com.ktg.common.enums.BusinessType;
|
||||
import com.ktg.common.utils.StringUtils;
|
||||
import com.ktg.mes.wm.domain.WmProductRecptLine;
|
||||
import com.ktg.mes.wm.domain.WmStorageArea;
|
||||
import com.ktg.mes.wm.domain.WmStorageLocation;
|
||||
import com.ktg.mes.wm.domain.WmWarehouse;
|
||||
import com.ktg.mes.wm.service.IWmProductRecptLineService;
|
||||
import com.ktg.mes.wm.service.IWmStorageAreaService;
|
||||
import com.ktg.mes.wm.service.IWmStorageLocationService;
|
||||
import com.ktg.mes.wm.service.IWmWarehouseService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Api("产品入库明细")
|
||||
@RestController
|
||||
@RequestMapping("/mobile/wm/productrecptline")
|
||||
public class WmProductRectpLineMobController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IWmProductRecptLineService wmProductRecptLineService;
|
||||
|
||||
@Autowired
|
||||
private IWmWarehouseService wmWarehouseService;
|
||||
|
||||
@Autowired
|
||||
private IWmStorageLocationService wmStorageLocationService;
|
||||
|
||||
@Autowired
|
||||
private IWmStorageAreaService wmStorageAreaService;
|
||||
|
||||
/**
|
||||
* 查询产品入库记录行列表
|
||||
*/
|
||||
@ApiOperation("查询产品入库单明细清单接口")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:productrecptline:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(WmProductRecptLine wmProductRecptLine)
|
||||
{
|
||||
startPage();
|
||||
List<WmProductRecptLine> list = wmProductRecptLineService.selectWmProductRecptLineList(wmProductRecptLine);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取产品入库记录行详细信息
|
||||
*/
|
||||
@ApiOperation("获取产品入库明细详情")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:productrecptline:query')")
|
||||
@GetMapping(value = "/{lineId}")
|
||||
public AjaxResult getInfo(@PathVariable("lineId") Long lineId)
|
||||
{
|
||||
return AjaxResult.success(wmProductRecptLineService.selectWmProductRecptLineByLineId(lineId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增产品入库记录行
|
||||
*/
|
||||
@ApiOperation("新增产品入库明细记录")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:productrecptline:add')")
|
||||
@Log(title = "产品入库记录行", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody WmProductRecptLine wmProductRecptLine)
|
||||
{
|
||||
if(StringUtils.isNotNull(wmProductRecptLine.getWarehouseId())){
|
||||
WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmProductRecptLine.getWarehouseId());
|
||||
wmProductRecptLine.setWarehouseCode(warehouse.getWarehouseCode());
|
||||
wmProductRecptLine.setWarehouseName(warehouse.getWarehouseName());
|
||||
}
|
||||
if(StringUtils.isNotNull(wmProductRecptLine.getLocationId())){
|
||||
WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmProductRecptLine.getLocationId());
|
||||
wmProductRecptLine.setLocationCode(location.getLocationCode());
|
||||
wmProductRecptLine.setLocationName(location.getLocationName());
|
||||
}
|
||||
if(StringUtils.isNotNull(wmProductRecptLine.getAreaId())){
|
||||
WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmProductRecptLine.getAreaId());
|
||||
wmProductRecptLine.setAreaCode(area.getAreaCode());
|
||||
wmProductRecptLine.setAreaName(area.getAreaName());
|
||||
}
|
||||
wmProductRecptLine.setCreateBy(getUsername());
|
||||
wmProductRecptLineService.insertWmProductRecptLine(wmProductRecptLine);
|
||||
return AjaxResult.success(wmProductRecptLine);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改产品入库记录行
|
||||
*/
|
||||
@ApiOperation("编辑产品入库明细记录")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:productrecptline:edit')")
|
||||
@Log(title = "产品入库记录行", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody WmProductRecptLine wmProductRecptLine)
|
||||
{
|
||||
if(StringUtils.isNotNull(wmProductRecptLine.getWarehouseId())){
|
||||
WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmProductRecptLine.getWarehouseId());
|
||||
wmProductRecptLine.setWarehouseCode(warehouse.getWarehouseCode());
|
||||
wmProductRecptLine.setWarehouseName(warehouse.getWarehouseName());
|
||||
}
|
||||
if(StringUtils.isNotNull(wmProductRecptLine.getLocationId())){
|
||||
WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmProductRecptLine.getLocationId());
|
||||
wmProductRecptLine.setLocationCode(location.getLocationCode());
|
||||
wmProductRecptLine.setLocationName(location.getLocationName());
|
||||
}
|
||||
if(StringUtils.isNotNull(wmProductRecptLine.getAreaId())){
|
||||
WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmProductRecptLine.getAreaId());
|
||||
wmProductRecptLine.setAreaCode(area.getAreaCode());
|
||||
wmProductRecptLine.setAreaName(area.getAreaName());
|
||||
}
|
||||
return toAjax(wmProductRecptLineService.updateWmProductRecptLine(wmProductRecptLine));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除产品入库记录行
|
||||
*/
|
||||
@ApiOperation("删除产品入库明细记录")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:productrecptline:remove')")
|
||||
@Log(title = "产品入库记录行", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{lineIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] lineIds)
|
||||
{
|
||||
return toAjax(wmProductRecptLineService.deleteWmProductRecptLineByLineIds(lineIds));
|
||||
}
|
||||
}
|
@ -0,0 +1,132 @@
|
||||
package com.ktg.mes.wm.controller.mobile;
|
||||
|
||||
import com.ktg.common.annotation.Log;
|
||||
import com.ktg.common.core.controller.BaseController;
|
||||
import com.ktg.common.core.domain.AjaxResult;
|
||||
import com.ktg.common.core.page.TableDataInfo;
|
||||
import com.ktg.common.enums.BusinessType;
|
||||
import com.ktg.common.utils.StringUtils;
|
||||
import com.ktg.mes.wm.domain.WmMaterialStock;
|
||||
import com.ktg.mes.wm.domain.WmProductSalseLine;
|
||||
import com.ktg.mes.wm.service.IWmMaterialStockService;
|
||||
import com.ktg.mes.wm.service.IWmProductSalseLineService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Api("产品销售出库明细")
|
||||
@RestController
|
||||
@RequestMapping("/mobile/wm/productsalseline")
|
||||
public class WmProductSalseLineMobController extends BaseController {
|
||||
@Autowired
|
||||
private IWmProductSalseLineService wmProductSalseLineService;
|
||||
|
||||
@Autowired
|
||||
private IWmMaterialStockService wmMaterialStockService;
|
||||
|
||||
/**
|
||||
*
|
||||
* 查询产品销售出库行列表
|
||||
*/
|
||||
@ApiOperation("查询销售出库行列表接口")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:productsalseline:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(WmProductSalseLine wmProductSalseLine)
|
||||
{
|
||||
startPage();
|
||||
List<WmProductSalseLine> list = wmProductSalseLineService.selectWmProductSalseLineList(wmProductSalseLine);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取产品销售出库行详细信息
|
||||
*/
|
||||
@ApiOperation("获取销售出库行信息明细接口")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:productsalseline:query')")
|
||||
@GetMapping(value = "/{lineId}")
|
||||
public AjaxResult getInfo(@PathVariable("lineId") Long lineId)
|
||||
{
|
||||
return AjaxResult.success(wmProductSalseLineService.selectWmProductSalseLineByLineId(lineId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增产品销售出库行
|
||||
*/
|
||||
@ApiOperation("新增销售出库信息明细信息接口")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:productsalseline:add')")
|
||||
@Log(title = "产品销售出库行", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody WmProductSalseLine wmProductSalseLine)
|
||||
{
|
||||
if(StringUtils.isNotNull(wmProductSalseLine.getMaterialStockId())){
|
||||
WmMaterialStock stock = wmMaterialStockService.selectWmMaterialStockByMaterialStockId(wmProductSalseLine.getMaterialStockId());
|
||||
wmProductSalseLine.setItemId(stock.getItemId());
|
||||
wmProductSalseLine.setItemCode(stock.getItemCode());
|
||||
wmProductSalseLine.setItemName(stock.getItemName());
|
||||
wmProductSalseLine.setSpecification(stock.getSpecification());
|
||||
wmProductSalseLine.setUnitOfMeasure(stock.getUnitOfMeasure());
|
||||
wmProductSalseLine.setBatchCode(stock.getBatchCode());
|
||||
wmProductSalseLine.setWarehouseId(stock.getWarehouseId());
|
||||
wmProductSalseLine.setWarehouseCode(stock.getWarehouseCode());
|
||||
wmProductSalseLine.setWarehouseName(stock.getWarehouseName());
|
||||
wmProductSalseLine.setLocationId(stock.getLocationId());
|
||||
wmProductSalseLine.setLocationCode(stock.getLocationCode());
|
||||
wmProductSalseLine.setLocationName(stock.getLocationName());
|
||||
wmProductSalseLine.setAreaId(stock.getAreaId());
|
||||
wmProductSalseLine.setAreaCode(stock.getAreaCode());
|
||||
wmProductSalseLine.setAreaName(stock.getAreaName());
|
||||
}
|
||||
|
||||
wmProductSalseLine.setCreateBy(getUsername());
|
||||
wmProductSalseLineService.insertWmProductSalseLine(wmProductSalseLine);
|
||||
return AjaxResult.success(wmProductSalseLine);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改产品销售出库行
|
||||
*/
|
||||
@ApiOperation("编辑销售出库明细信息接口")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:productsalseline:edit')")
|
||||
@Log(title = "产品销售出库行", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody WmProductSalseLine wmProductSalseLine)
|
||||
{
|
||||
if(StringUtils.isNotNull(wmProductSalseLine.getMaterialStockId())){
|
||||
WmMaterialStock stock = wmMaterialStockService.selectWmMaterialStockByMaterialStockId(wmProductSalseLine.getMaterialStockId());
|
||||
wmProductSalseLine.setItemId(stock.getItemId());
|
||||
wmProductSalseLine.setItemCode(stock.getItemCode());
|
||||
wmProductSalseLine.setItemName(stock.getItemName());
|
||||
wmProductSalseLine.setSpecification(stock.getSpecification());
|
||||
wmProductSalseLine.setUnitOfMeasure(stock.getUnitOfMeasure());
|
||||
wmProductSalseLine.setBatchCode(stock.getBatchCode());
|
||||
wmProductSalseLine.setWarehouseId(stock.getWarehouseId());
|
||||
wmProductSalseLine.setWarehouseCode(stock.getWarehouseCode());
|
||||
wmProductSalseLine.setWarehouseName(stock.getWarehouseName());
|
||||
wmProductSalseLine.setLocationId(stock.getLocationId());
|
||||
wmProductSalseLine.setLocationCode(stock.getLocationCode());
|
||||
wmProductSalseLine.setLocationName(stock.getLocationName());
|
||||
wmProductSalseLine.setAreaId(stock.getAreaId());
|
||||
wmProductSalseLine.setAreaCode(stock.getAreaCode());
|
||||
wmProductSalseLine.setAreaName(stock.getAreaName());
|
||||
}
|
||||
|
||||
return toAjax(wmProductSalseLineService.updateWmProductSalseLine(wmProductSalseLine));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除产品销售出库行
|
||||
*/
|
||||
@ApiOperation("删除销售出库明细信息接口")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:productsalseline:remove')")
|
||||
@Log(title = "产品销售出库行", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{lineIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] lineIds)
|
||||
{
|
||||
return toAjax(wmProductSalseLineService.deleteWmProductSalseLineByLineIds(lineIds));
|
||||
}
|
||||
}
|
@ -0,0 +1,181 @@
|
||||
package com.ktg.mes.wm.controller.mobile;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.ktg.common.annotation.Log;
|
||||
import com.ktg.common.constant.UserConstants;
|
||||
import com.ktg.common.core.controller.BaseController;
|
||||
import com.ktg.common.core.domain.AjaxResult;
|
||||
import com.ktg.common.core.page.TableDataInfo;
|
||||
import com.ktg.common.enums.BusinessType;
|
||||
import com.ktg.common.utils.StringUtils;
|
||||
import com.ktg.common.utils.poi.ExcelUtil;
|
||||
import com.ktg.mes.md.domain.MdClient;
|
||||
import com.ktg.mes.md.service.IMdClientService;
|
||||
import com.ktg.mes.wm.domain.*;
|
||||
import com.ktg.mes.wm.domain.tx.ProductSalseTxBean;
|
||||
import com.ktg.mes.wm.service.*;
|
||||
import com.ktg.system.strategy.AutoCodeUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
@Api("产品销售出库")
|
||||
@RestController
|
||||
@RequestMapping("/mobile/wm/productsalse")
|
||||
public class WmProductSalseMobController extends BaseController {
|
||||
@Autowired
|
||||
private IWmProductSalseService wmProductSalseService;
|
||||
|
||||
@Autowired
|
||||
private IWmProductSalseLineService wmProductSalseLineService;
|
||||
|
||||
@Autowired
|
||||
private IWmWarehouseService wmWarehouseService;
|
||||
|
||||
@Autowired
|
||||
private IWmStorageLocationService wmStorageLocationService;
|
||||
|
||||
@Autowired
|
||||
private IWmStorageAreaService wmStorageAreaService;
|
||||
|
||||
@Autowired
|
||||
private IStorageCoreService storageCoreService;
|
||||
|
||||
@Autowired
|
||||
private IMdClientService mdClientService;
|
||||
|
||||
@Autowired
|
||||
private AutoCodeUtil autoCodeUtil;
|
||||
|
||||
/**
|
||||
* 查询销售出库单列表
|
||||
*/
|
||||
@ApiOperation("查询销售出库单清单接口")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:productsalse:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(WmProductSalse wmProductSalse)
|
||||
{
|
||||
startPage();
|
||||
List<WmProductSalse> list = wmProductSalseService.selectWmProductSalseList(wmProductSalse);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取销售出库单详细信息
|
||||
*/
|
||||
@ApiOperation("获取销售出库单明细信息接口")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:productsalse:query')")
|
||||
@GetMapping(value = "/{salseId}")
|
||||
public AjaxResult getInfo(@PathVariable("salseId") Long salseId)
|
||||
{
|
||||
return AjaxResult.success(wmProductSalseService.selectWmProductSalseBySalseId(salseId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增销售出库单
|
||||
*/
|
||||
@ApiOperation("新增销售出库单基本信息接口")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:productsalse:add')")
|
||||
@Log(title = "销售出库单", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody WmProductSalse wmProductSalse)
|
||||
{
|
||||
if(StringUtils.isNotNull(wmProductSalse.getSalseCode())){
|
||||
if(UserConstants.NOT_UNIQUE.equals(wmProductSalseService.checkUnique(wmProductSalse))){
|
||||
return AjaxResult.error("出库单编号已存在!");
|
||||
}
|
||||
}else {
|
||||
wmProductSalse.setSalseCode(autoCodeUtil.genSerialCode(UserConstants.PRODUCTSALSE_CODE,""));
|
||||
}
|
||||
|
||||
if(StringUtils.isNotNull(wmProductSalse.getClientId())){
|
||||
MdClient client = mdClientService.selectMdClientByClientId(wmProductSalse.getClientId());
|
||||
wmProductSalse.setClientCode(client.getClientCode());
|
||||
wmProductSalse.setClientName(client.getClientName());
|
||||
wmProductSalse.setClientNick(client.getClientNick());
|
||||
}
|
||||
|
||||
wmProductSalse.setCreateBy(getUsername());
|
||||
wmProductSalseService.insertWmProductSalse(wmProductSalse);
|
||||
return AjaxResult.success(wmProductSalse);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改销售出库单
|
||||
*/
|
||||
@ApiOperation("编辑销售出库单基本信息接口")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:productsalse:edit')")
|
||||
@Log(title = "销售出库单", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody WmProductSalse wmProductSalse)
|
||||
{
|
||||
if(UserConstants.NOT_UNIQUE.equals(wmProductSalseService.checkUnique(wmProductSalse))){
|
||||
return AjaxResult.error("出库单编号已存在!");
|
||||
}
|
||||
|
||||
if(StringUtils.isNotNull(wmProductSalse.getClientId())){
|
||||
MdClient client = mdClientService.selectMdClientByClientId(wmProductSalse.getClientId());
|
||||
wmProductSalse.setClientCode(client.getClientCode());
|
||||
wmProductSalse.setClientName(client.getClientName());
|
||||
wmProductSalse.setClientNick(client.getClientNick());
|
||||
}
|
||||
|
||||
return toAjax(wmProductSalseService.updateWmProductSalse(wmProductSalse));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除销售出库单
|
||||
*/
|
||||
@ApiOperation("删除销售出库单信息接口")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:productsalse:remove')")
|
||||
@Log(title = "销售出库单", businessType = BusinessType.DELETE)
|
||||
@Transactional
|
||||
@DeleteMapping("/{salseIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] salseIds)
|
||||
{
|
||||
for (Long salseId: salseIds
|
||||
) {
|
||||
WmProductSalse salse = wmProductSalseService.selectWmProductSalseBySalseId(salseId);
|
||||
if(!UserConstants.ORDER_STATUS_PREPARE.equals(salse.getStatus())){
|
||||
return AjaxResult.error("只能删除草稿状态的单据!");
|
||||
}
|
||||
|
||||
wmProductSalseLineService.deleteBySalseId(salseId);
|
||||
}
|
||||
return toAjax(wmProductSalseService.deleteWmProductSalseBySalseIds(salseIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行出库
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("执行销售出库接口")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:productsalse:edit')")
|
||||
@Log(title = "销售出库单", businessType = BusinessType.UPDATE)
|
||||
@Transactional
|
||||
@PutMapping("/{salseId}")
|
||||
public AjaxResult execute(@PathVariable Long salseId){
|
||||
WmProductSalse salse = wmProductSalseService.selectWmProductSalseBySalseId(salseId);
|
||||
|
||||
WmProductSalseLine param = new WmProductSalseLine();
|
||||
param.setSalseId(salseId);
|
||||
List<WmProductSalseLine> lines = wmProductSalseLineService.selectWmProductSalseLineList(param);
|
||||
if(CollectionUtil.isEmpty(lines)){
|
||||
return AjaxResult.error("出库物资不能为空");
|
||||
}
|
||||
|
||||
List<ProductSalseTxBean> beans = wmProductSalseService.getTxBeans(salseId);
|
||||
storageCoreService.processProductSalse(beans);
|
||||
|
||||
salse.setStatus(UserConstants.ORDER_STATUS_FINISHED);
|
||||
wmProductSalseService.updateWmProductSalse(salse);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
@ -0,0 +1,157 @@
|
||||
package com.ktg.mes.wm.controller.mobile;
|
||||
|
||||
import com.ktg.common.annotation.Log;
|
||||
import com.ktg.common.core.controller.BaseController;
|
||||
import com.ktg.common.core.domain.AjaxResult;
|
||||
import com.ktg.common.core.page.TableDataInfo;
|
||||
import com.ktg.common.enums.BusinessType;
|
||||
import com.ktg.common.utils.StringUtils;
|
||||
import com.ktg.common.utils.poi.ExcelUtil;
|
||||
import com.ktg.mes.md.domain.MdItem;
|
||||
import com.ktg.mes.md.service.IMdItemService;
|
||||
import com.ktg.mes.wm.domain.WmRtSalseLine;
|
||||
import com.ktg.mes.wm.domain.WmStorageArea;
|
||||
import com.ktg.mes.wm.domain.WmStorageLocation;
|
||||
import com.ktg.mes.wm.domain.WmWarehouse;
|
||||
import com.ktg.mes.wm.service.IWmRtSalseLineService;
|
||||
import com.ktg.mes.wm.service.IWmStorageAreaService;
|
||||
import com.ktg.mes.wm.service.IWmStorageLocationService;
|
||||
import com.ktg.mes.wm.service.IWmWarehouseService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.poi.hssf.record.pivottable.PageItemRecord;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
@Api("销售退货明细")
|
||||
@RestController
|
||||
@RequestMapping("/mobile/wm/rtsalseline")
|
||||
public class WmRtSalseLineMobController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IWmRtSalseLineService wmRtSalseLineService;
|
||||
|
||||
@Autowired
|
||||
private IWmWarehouseService wmWarehouseService;
|
||||
|
||||
@Autowired
|
||||
private IWmStorageLocationService wmStorageLocationService;
|
||||
|
||||
@Autowired
|
||||
private IWmStorageAreaService wmStorageAreaService;
|
||||
|
||||
@Autowired
|
||||
private IMdItemService mdItemService;
|
||||
|
||||
/**
|
||||
* 查询产品销售退货行列表
|
||||
*/
|
||||
@ApiOperation("查询销售退货单明细列表接口")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:rtsalse:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(WmRtSalseLine wmRtSalseLine)
|
||||
{
|
||||
startPage();
|
||||
List<WmRtSalseLine> list = wmRtSalseLineService.selectWmRtSalseLineList(wmRtSalseLine);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取产品销售退货行详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:rtsalse:query')")
|
||||
@GetMapping(value = "/{lineId}")
|
||||
public AjaxResult getInfo(@PathVariable("lineId") Long lineId)
|
||||
{
|
||||
return AjaxResult.success(wmRtSalseLineService.selectWmRtSalseLineByLineId(lineId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增产品销售退货行
|
||||
*/
|
||||
@ApiOperation("新增销售退货单明细接口")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:rtsalse:add')")
|
||||
@Log(title = "产品销售退货行", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody WmRtSalseLine wmRtSalseLine)
|
||||
{
|
||||
if(StringUtils.isNotNull(wmRtSalseLine.getItemId())){
|
||||
MdItem item = mdItemService.selectMdItemById(wmRtSalseLine.getItemId());
|
||||
wmRtSalseLine.setItemCode(item.getItemCode());
|
||||
wmRtSalseLine.setItemName(item.getItemName());
|
||||
wmRtSalseLine.setSpecification(item.getSpecification());
|
||||
wmRtSalseLine.setUnitOfMeasure(item.getUnitOfMeasure());
|
||||
}
|
||||
|
||||
if(StringUtils.isNotNull(wmRtSalseLine.getWarehouseId())){
|
||||
WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmRtSalseLine.getWarehouseId());
|
||||
wmRtSalseLine.setWarehouseCode(warehouse.getWarehouseCode());
|
||||
wmRtSalseLine.setWarehouseName(warehouse.getWarehouseName());
|
||||
}
|
||||
if(StringUtils.isNotNull(wmRtSalseLine.getLocationId())){
|
||||
WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmRtSalseLine.getLocationId());
|
||||
wmRtSalseLine.setLocationCode(location.getLocationCode());
|
||||
wmRtSalseLine.setLocationName(location.getLocationName());
|
||||
}
|
||||
if(StringUtils.isNotNull(wmRtSalseLine.getAreaId())){
|
||||
WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmRtSalseLine.getAreaId());
|
||||
wmRtSalseLine.setAreaCode(area.getAreaCode());
|
||||
wmRtSalseLine.setAreaName(area.getAreaName());
|
||||
}
|
||||
wmRtSalseLine.setCreateBy(getUsername());
|
||||
return toAjax(wmRtSalseLineService.insertWmRtSalseLine(wmRtSalseLine));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改产品销售退货行
|
||||
*/
|
||||
@ApiOperation("编辑销售退货单明细接口")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:rtsalse:edit')")
|
||||
@Log(title = "产品销售退货行", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody WmRtSalseLine wmRtSalseLine)
|
||||
{
|
||||
if(StringUtils.isNotNull(wmRtSalseLine.getItemId())){
|
||||
MdItem item = mdItemService.selectMdItemById(wmRtSalseLine.getItemId());
|
||||
wmRtSalseLine.setItemCode(item.getItemCode());
|
||||
wmRtSalseLine.setItemName(item.getItemName());
|
||||
wmRtSalseLine.setSpecification(item.getSpecification());
|
||||
wmRtSalseLine.setUnitOfMeasure(item.getUnitOfMeasure());
|
||||
}
|
||||
|
||||
if(StringUtils.isNotNull(wmRtSalseLine.getWarehouseId())){
|
||||
WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmRtSalseLine.getWarehouseId());
|
||||
wmRtSalseLine.setWarehouseCode(warehouse.getWarehouseCode());
|
||||
wmRtSalseLine.setWarehouseName(warehouse.getWarehouseName());
|
||||
}
|
||||
if(StringUtils.isNotNull(wmRtSalseLine.getLocationId())){
|
||||
WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmRtSalseLine.getLocationId());
|
||||
wmRtSalseLine.setLocationCode(location.getLocationCode());
|
||||
wmRtSalseLine.setLocationName(location.getLocationName());
|
||||
}
|
||||
if(StringUtils.isNotNull(wmRtSalseLine.getAreaId())){
|
||||
WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmRtSalseLine.getAreaId());
|
||||
wmRtSalseLine.setAreaCode(area.getAreaCode());
|
||||
wmRtSalseLine.setAreaName(area.getAreaName());
|
||||
}
|
||||
return toAjax(wmRtSalseLineService.updateWmRtSalseLine(wmRtSalseLine));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除产品销售退货行
|
||||
*/
|
||||
@ApiOperation("删除销售退货单明细接口")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:rtsalse:remove')")
|
||||
@Log(title = "产品销售退货行", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{lineIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] lineIds)
|
||||
{
|
||||
return toAjax(wmRtSalseLineService.deleteWmRtSalseLineByLineIds(lineIds));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,175 @@
|
||||
package com.ktg.mes.wm.controller.mobile;
|
||||
|
||||
import com.ktg.common.annotation.Log;
|
||||
import com.ktg.common.constant.UserConstants;
|
||||
import com.ktg.common.core.controller.BaseController;
|
||||
import com.ktg.common.core.domain.AjaxResult;
|
||||
import com.ktg.common.core.page.TableDataInfo;
|
||||
import com.ktg.common.enums.BusinessType;
|
||||
import com.ktg.common.utils.StringUtils;
|
||||
import com.ktg.common.utils.poi.ExcelUtil;
|
||||
import com.ktg.mes.md.domain.MdClient;
|
||||
import com.ktg.mes.md.service.IMdClientService;
|
||||
import com.ktg.mes.wm.domain.*;
|
||||
import com.ktg.mes.wm.domain.tx.RtSalseTxBean;
|
||||
import com.ktg.mes.wm.service.*;
|
||||
import com.ktg.system.strategy.AutoCodeUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
@Api("销售退货")
|
||||
@RestController
|
||||
@RequestMapping("/mobile/wm/rtsalse")
|
||||
public class WmRtSalseMobController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IWmRtSalseService wmRtSalseService;
|
||||
|
||||
@Autowired
|
||||
private IWmRtSalseLineService wmRtSalseLineService;
|
||||
|
||||
@Autowired
|
||||
private IStorageCoreService storageCoreService;
|
||||
|
||||
@Autowired
|
||||
private IMdClientService mdClientService;
|
||||
|
||||
@Autowired
|
||||
private AutoCodeUtil autoCodeUtil;
|
||||
|
||||
/**
|
||||
* 查询产品销售退货单列表
|
||||
*/
|
||||
@ApiOperation("查询销售退货单列表接口")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:rtsalse:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(WmRtSalse wmRtSalse)
|
||||
{
|
||||
startPage();
|
||||
List<WmRtSalse> list = wmRtSalseService.selectWmRtSalseList(wmRtSalse);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取产品销售退货单详细信息
|
||||
*/
|
||||
@ApiOperation("获取销售退货单详细信息接口")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:rtsalse:query')")
|
||||
@GetMapping(value = "/{rtId}")
|
||||
public AjaxResult getInfo(@PathVariable("rtId") Long rtId)
|
||||
{
|
||||
return AjaxResult.success(wmRtSalseService.selectWmRtSalseByRtId(rtId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增产品销售退货单
|
||||
*/
|
||||
@ApiOperation("新增销售退货单基本信息接口")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:rtsalse:add')")
|
||||
@Log(title = "产品销售退货单", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody WmRtSalse wmRtSalse)
|
||||
{
|
||||
if(StringUtils.isNotNull(wmRtSalse.getRtCode())){
|
||||
if(UserConstants.NOT_UNIQUE.equals(wmRtSalseService.checkUnique(wmRtSalse))){
|
||||
return AjaxResult.error("退货单号已存在!");
|
||||
}
|
||||
}else {
|
||||
wmRtSalse.setRtCode(autoCodeUtil.genSerialCode(UserConstants.RTSALSE_CODE,""));
|
||||
}
|
||||
|
||||
if(StringUtils.isNotNull(wmRtSalse.getClientId())){
|
||||
MdClient client = mdClientService.selectMdClientByClientId(wmRtSalse.getClientId());
|
||||
wmRtSalse.setClientCode(client.getClientCode());
|
||||
wmRtSalse.setClientName(client.getClientName());
|
||||
wmRtSalse.setClientNick(client.getClientNick());
|
||||
}
|
||||
|
||||
wmRtSalse.setCreateBy(getUsername());
|
||||
wmRtSalseService.insertWmRtSalse(wmRtSalse);
|
||||
return AjaxResult.success(wmRtSalse);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改产品销售退货单
|
||||
*/
|
||||
@ApiOperation("编辑销售退货单基本信息接口")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:rtsalse:edit')")
|
||||
@Log(title = "产品销售退货单", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody WmRtSalse wmRtSalse)
|
||||
{
|
||||
if(UserConstants.NOT_UNIQUE.equals(wmRtSalseService.checkUnique(wmRtSalse))){
|
||||
return AjaxResult.error("退货单号已存在!");
|
||||
}
|
||||
|
||||
if(StringUtils.isNotNull(wmRtSalse.getClientId())){
|
||||
MdClient client = mdClientService.selectMdClientByClientId(wmRtSalse.getClientId());
|
||||
wmRtSalse.setClientCode(client.getClientCode());
|
||||
wmRtSalse.setClientName(client.getClientName());
|
||||
wmRtSalse.setClientNick(client.getClientNick());
|
||||
}
|
||||
|
||||
return toAjax(wmRtSalseService.updateWmRtSalse(wmRtSalse));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除产品销售退货单
|
||||
*/
|
||||
@ApiOperation("删除销售退货单基本信息接口")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:rtsalse:remove')")
|
||||
@Log(title = "产品销售退货单", businessType = BusinessType.DELETE)
|
||||
@Transactional
|
||||
@DeleteMapping("/{rtIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] rtIds)
|
||||
{
|
||||
for (Long rtId: rtIds
|
||||
) {
|
||||
WmRtSalse rtSalse = wmRtSalseService.selectWmRtSalseByRtId(rtId);
|
||||
if(!UserConstants.ORDER_STATUS_PREPARE.equals(rtSalse.getStatus())){
|
||||
return AjaxResult.error("只能删除草稿状态单据");
|
||||
}
|
||||
|
||||
wmRtSalseLineService.deleteByRtId(rtId);
|
||||
}
|
||||
|
||||
return toAjax(wmRtSalseService.deleteWmRtSalseByRtIds(rtIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行退货
|
||||
* @param rtId
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("执行销售退货接口")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:rtsalse:edit')")
|
||||
@Log(title = "产品销售退货单", businessType = BusinessType.UPDATE)
|
||||
@Transactional
|
||||
@PutMapping("/{rtId}")
|
||||
public AjaxResult execute(@PathVariable Long rtId){
|
||||
WmRtSalse rtSalse = wmRtSalseService.selectWmRtSalseByRtId(rtId);
|
||||
WmRtSalseLine param = new WmRtSalseLine();
|
||||
param.setRtId(rtId);
|
||||
List<WmRtSalseLine> lines = wmRtSalseLineService.selectWmRtSalseLineList(param);
|
||||
if(CollectionUtils.isEmpty(lines)){
|
||||
return AjaxResult.error("请添加退货单行信息!");
|
||||
}
|
||||
|
||||
List<RtSalseTxBean> beans = wmRtSalseService.getTxBeans(rtId);
|
||||
|
||||
storageCoreService.processRtSalse(beans);
|
||||
|
||||
rtSalse.setStatus(UserConstants.ORDER_STATUS_FINISHED);
|
||||
wmRtSalseService.updateWmRtSalse(rtSalse);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
@ -0,0 +1,124 @@
|
||||
package com.ktg.mes.wm.controller.mobile;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.ktg.common.annotation.Log;
|
||||
import com.ktg.common.constant.UserConstants;
|
||||
import com.ktg.common.core.controller.BaseController;
|
||||
import com.ktg.common.core.domain.AjaxResult;
|
||||
import com.ktg.common.core.page.TableDataInfo;
|
||||
import com.ktg.common.enums.BusinessType;
|
||||
import com.ktg.common.utils.poi.ExcelUtil;
|
||||
import com.ktg.mes.wm.domain.WmSn;
|
||||
import com.ktg.mes.wm.service.IWmSnService;
|
||||
import com.ktg.system.strategy.AutoCodeUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Api("SN码")
|
||||
@RestController
|
||||
@RequestMapping("/mobile/wm/sn")
|
||||
public class WmSnMobController extends BaseController {
|
||||
@Autowired
|
||||
private IWmSnService wmSnService;
|
||||
|
||||
@Autowired
|
||||
private AutoCodeUtil autoCodeUtil;
|
||||
|
||||
/**
|
||||
* 查询SN码列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:sn:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(WmSn wmSn)
|
||||
{
|
||||
startPage();
|
||||
List<WmSn> list = wmSnService.selectWmSnList(wmSn);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询SN码列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:sn:list')")
|
||||
@GetMapping("/listSn")
|
||||
public TableDataInfo listSn(WmSn wmSn)
|
||||
{
|
||||
startPage();
|
||||
List<WmSn> list = wmSnService.selectSnList(wmSn);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出SN码列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:sn:export')")
|
||||
@Log(title = "SN码", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, WmSn wmSn)
|
||||
{
|
||||
List<WmSn> list = wmSnService.selectWmSnList(wmSn);
|
||||
ExcelUtil<WmSn> util = new ExcelUtil<WmSn>(WmSn.class);
|
||||
util.exportExcel(response, list, "SN码数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取SN码详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:sn:query')")
|
||||
@GetMapping(value = "/{snId}")
|
||||
public AjaxResult getInfo(@PathVariable("snId") Long snId)
|
||||
{
|
||||
return AjaxResult.success(wmSnService.selectWmSnBySnId(snId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增SN码
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:sn:add')")
|
||||
@Log(title = "SN码", businessType = BusinessType.INSERT)
|
||||
@Transactional
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody WmSn wmSn)
|
||||
{
|
||||
Date genDate = DateUtil.date();
|
||||
wmSn.setGenDate(genDate);
|
||||
String SNCode= null;
|
||||
if(wmSn.getSnNum()>0){
|
||||
for(int i=0;i<wmSn.getSnNum();i++){
|
||||
SNCode = autoCodeUtil.genSerialCode(UserConstants.SN_CODE,wmSn.getItemCode());
|
||||
wmSn.setSnCode(SNCode);
|
||||
wmSnService.insertWmSn(wmSn);
|
||||
}
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改SN码
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:sn:edit')")
|
||||
@Log(title = "SN码", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody WmSn wmSn)
|
||||
{
|
||||
return toAjax(wmSnService.updateWmSn(wmSn));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除SN码
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:sn:remove')")
|
||||
@Log(title = "SN码", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{snIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] snIds)
|
||||
{
|
||||
return toAjax(wmSnService.deleteWmSnBySnIds(snIds));
|
||||
}
|
||||
}
|
@ -0,0 +1,101 @@
|
||||
package com.ktg.mes.wm.controller.mobile;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ktg.common.annotation.Log;
|
||||
import com.ktg.common.core.controller.BaseController;
|
||||
import com.ktg.common.core.domain.AjaxResult;
|
||||
import com.ktg.common.enums.BusinessType;
|
||||
import com.ktg.mes.wm.domain.WmStockTakingLine;
|
||||
import com.ktg.mes.wm.service.IWmStockTakingLineService;
|
||||
import com.ktg.common.utils.poi.ExcelUtil;
|
||||
import com.ktg.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 库存盘点明细Controller
|
||||
*
|
||||
* @author yinjinlu
|
||||
* @date 2023-08-17
|
||||
*/
|
||||
@Api("物资盘点明细")
|
||||
@RestController
|
||||
@RequestMapping("/mobile/wm/stocktakingline")
|
||||
public class WmStockTakingLineMobController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IWmStockTakingLineService wmStockTakingLineService;
|
||||
|
||||
/**
|
||||
* 查询库存盘点明细列表
|
||||
*/
|
||||
@ApiOperation("查询库存盘点明细列表接口")
|
||||
@PreAuthorize("@ss.hasPermi('wm:stocktakingline:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(WmStockTakingLine wmStockTakingLine)
|
||||
{
|
||||
startPage();
|
||||
List<WmStockTakingLine> list = wmStockTakingLineService.selectWmStockTakingLineList(wmStockTakingLine);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取库存盘点明细详细信息
|
||||
*/
|
||||
@ApiOperation("查询库存盘点明细信息接口")
|
||||
@PreAuthorize("@ss.hasPermi('wm:stocktakingline:query')")
|
||||
@GetMapping(value = "/{lineId}")
|
||||
public AjaxResult getInfo(@PathVariable("lineId") Long lineId)
|
||||
{
|
||||
return AjaxResult.success(wmStockTakingLineService.selectWmStockTakingLineByLineId(lineId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增库存盘点明细
|
||||
*/
|
||||
@ApiOperation("新增库存盘点明细接口")
|
||||
@PreAuthorize("@ss.hasPermi('wm:stocktakingline:add')")
|
||||
@Log(title = "库存盘点明细", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody WmStockTakingLine wmStockTakingLine)
|
||||
{
|
||||
return toAjax(wmStockTakingLineService.insertWmStockTakingLine(wmStockTakingLine));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改库存盘点明细
|
||||
*/
|
||||
@ApiOperation("编辑库存盘点明细接口")
|
||||
@PreAuthorize("@ss.hasPermi('wm:stocktakingline:edit')")
|
||||
@Log(title = "库存盘点明细", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody WmStockTakingLine wmStockTakingLine)
|
||||
{
|
||||
return toAjax(wmStockTakingLineService.updateWmStockTakingLine(wmStockTakingLine));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除库存盘点明细
|
||||
*/
|
||||
@ApiOperation("删除库存盘点明细接口")
|
||||
@PreAuthorize("@ss.hasPermi('wm:stocktakingline:remove')")
|
||||
@Log(title = "库存盘点明细", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{lineIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] lineIds)
|
||||
{
|
||||
return toAjax(wmStockTakingLineService.deleteWmStockTakingLineByLineIds(lineIds));
|
||||
}
|
||||
}
|
@ -0,0 +1,173 @@
|
||||
package com.ktg.mes.wm.controller.mobile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ktg.common.constant.UserConstants;
|
||||
import com.ktg.common.utils.StringUtils;
|
||||
import com.ktg.mes.wm.domain.*;
|
||||
import com.ktg.mes.wm.service.IWmStockTakingLineService;
|
||||
import com.ktg.mes.wm.service.IWmStockTakingResultService;
|
||||
import com.ktg.mes.wm.service.IWmWarehouseService;
|
||||
import com.ktg.system.strategy.AutoCodeUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ktg.common.annotation.Log;
|
||||
import com.ktg.common.core.controller.BaseController;
|
||||
import com.ktg.common.core.domain.AjaxResult;
|
||||
import com.ktg.common.enums.BusinessType;
|
||||
import com.ktg.mes.wm.service.IWmStockTakingService;
|
||||
import com.ktg.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 库存盘点记录Controller
|
||||
*
|
||||
* @author yinjinlu
|
||||
* @date 2023-08-17
|
||||
*/
|
||||
@Api("物资盘点")
|
||||
@RestController
|
||||
@RequestMapping("/mobile/wm/stocktaking")
|
||||
public class WmStockTakingMobController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IWmStockTakingService wmStockTakingService;
|
||||
|
||||
@Autowired
|
||||
private IWmStockTakingLineService wmStockTakingLineService;
|
||||
|
||||
@Autowired
|
||||
private IWmStockTakingResultService wmStockTakingResultService;
|
||||
|
||||
@Autowired
|
||||
private AutoCodeUtil autoCodeUtil;
|
||||
|
||||
@Autowired
|
||||
private IWmWarehouseService wmWarehouseService;
|
||||
|
||||
/**
|
||||
* 查询库存盘点记录列表
|
||||
*/
|
||||
@ApiOperation("查询库存盘点单列表接口")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:stocktaking:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(WmStockTaking wmStockTaking)
|
||||
{
|
||||
startPage();
|
||||
List<WmStockTaking> list = wmStockTakingService.selectWmStockTakingList(wmStockTaking);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取库存盘点记录详细信息
|
||||
*/
|
||||
@ApiOperation("获取库存盘点单详情接口")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:stocktaking:query')")
|
||||
@GetMapping(value = "/{takingId}")
|
||||
public AjaxResult getInfo(@PathVariable("takingId") Long takingId)
|
||||
{
|
||||
return AjaxResult.success(wmStockTakingService.selectWmStockTakingByTakingId(takingId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增库存盘点记录
|
||||
*/
|
||||
@ApiOperation("新增库存盘点单基本信息接口")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:stocktaking:add')")
|
||||
@Log(title = "库存盘点记录", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody WmStockTaking wmStockTaking)
|
||||
{
|
||||
if(StringUtils.isNotNull(wmStockTaking.getTakingCode())){
|
||||
if(UserConstants.NOT_UNIQUE.equals(wmStockTakingService.checkUnique(wmStockTaking))){
|
||||
return AjaxResult.error("单据编号已存在!");
|
||||
}
|
||||
}else {
|
||||
wmStockTaking.setTakingCode(autoCodeUtil.genSerialCode(UserConstants.STOCKTAKING_CODE,""));
|
||||
}
|
||||
|
||||
if(StringUtils.isNotNull(wmStockTaking.getWarehouseId())){
|
||||
WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmStockTaking.getWarehouseId());
|
||||
wmStockTaking.setWarehouseCode(warehouse.getWarehouseCode());
|
||||
wmStockTaking.setWarehouseName(warehouse.getWarehouseName());
|
||||
}
|
||||
|
||||
wmStockTakingService.insertWmStockTaking(wmStockTaking);
|
||||
wmStockTaking.setCreateBy(getUsername());
|
||||
return AjaxResult.success(wmStockTaking);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改库存盘点记录
|
||||
*/
|
||||
@ApiOperation("编辑库存盘点单基本信息接口")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:stocktaking:edit')")
|
||||
@Log(title = "库存盘点记录", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody WmStockTaking wmStockTaking)
|
||||
{
|
||||
if(StringUtils.isNotNull(wmStockTaking.getWarehouseId())){
|
||||
WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmStockTaking.getWarehouseId());
|
||||
wmStockTaking.setWarehouseCode(warehouse.getWarehouseCode());
|
||||
wmStockTaking.setWarehouseName(warehouse.getWarehouseName());
|
||||
}
|
||||
return toAjax(wmStockTakingService.updateWmStockTaking(wmStockTaking));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除库存盘点记录
|
||||
*/
|
||||
@ApiOperation("删除库存盘点单接口")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:stocktaking:remove')")
|
||||
@Log(title = "库存盘点记录", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{takingIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] takingIds)
|
||||
{
|
||||
return toAjax(wmStockTakingService.deleteWmStockTakingByTakingIds(takingIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 完成盘点,系统对比计算盘点结果
|
||||
*/
|
||||
@ApiOperation("执行盘点接口")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:stocktaking:edit')")
|
||||
@Log(title = "盘点单", businessType = BusinessType.UPDATE)
|
||||
@Transactional
|
||||
@PutMapping("/{takingId}")
|
||||
public AjaxResult execute(@PathVariable Long takingId){
|
||||
WmStockTaking taking = wmStockTakingService.selectWmStockTakingByTakingId(takingId);
|
||||
|
||||
WmStockTakingLine param = new WmStockTakingLine();
|
||||
param.setTakingId(takingId);
|
||||
List<WmStockTakingLine> lines = wmStockTakingLineService.selectWmStockTakingLineList(param);
|
||||
if(CollectionUtils.isEmpty(lines)){
|
||||
return AjaxResult.error("未检测到盘点的物资!");
|
||||
}
|
||||
|
||||
//先删除历史记录
|
||||
wmStockTakingResultService.deleteWmStockTakingResultByTakingId(takingId);
|
||||
|
||||
if(UserConstants.WM_STOCK_TAKING_TYPE_OPEN.equals(taking.getTakingType())){
|
||||
//如果是明盘,则直接对比明细中的库存数量和盘点数量
|
||||
wmStockTakingResultService.calculateOpenWmStockTakingResult(takingId);
|
||||
}else {
|
||||
//如果是盲盘,则对比盘点明细中的盘点数量,和当前库存现有量的数量
|
||||
wmStockTakingResultService.calculateWmStockTakingResult(takingId);
|
||||
}
|
||||
|
||||
taking.setStatus(UserConstants.ORDER_STATUS_APPROVED);
|
||||
wmStockTakingService.updateWmStockTaking(taking);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
@ -0,0 +1,89 @@
|
||||
package com.ktg.mes.wm.controller.mobile;
|
||||
|
||||
import com.ktg.common.annotation.Log;
|
||||
import com.ktg.common.core.controller.BaseController;
|
||||
import com.ktg.common.core.domain.AjaxResult;
|
||||
import com.ktg.common.core.page.TableDataInfo;
|
||||
import com.ktg.common.enums.BusinessType;
|
||||
import com.ktg.common.utils.poi.ExcelUtil;
|
||||
import com.ktg.mes.wm.domain.WmStockTakingResult;
|
||||
import com.ktg.mes.wm.service.IWmStockTakingResultService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
@Api("物资盘点结果")
|
||||
@RestController
|
||||
@RequestMapping("/mobile/wm/stocktakingresult")
|
||||
public class WmStockTakingResultMobController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IWmStockTakingResultService wmStockTakingResultService;
|
||||
|
||||
/**
|
||||
* 查询库存盘点结果列表
|
||||
*/
|
||||
@ApiOperation("查询库存盘点结果列表接口")
|
||||
@PreAuthorize("@ss.hasPermi('wm:stocktakingresult:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(WmStockTakingResult wmStockTakingResult)
|
||||
{
|
||||
startPage();
|
||||
List<WmStockTakingResult> list = wmStockTakingResultService.selectWmStockTakingResultList(wmStockTakingResult);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取库存盘点结果详细信息
|
||||
*/
|
||||
@ApiOperation("查询库存盘点结果详情接口")
|
||||
@PreAuthorize("@ss.hasPermi('wm:stocktakingresult:query')")
|
||||
@GetMapping(value = "/{resultId}")
|
||||
public AjaxResult getInfo(@PathVariable("resultId") Long resultId)
|
||||
{
|
||||
return AjaxResult.success(wmStockTakingResultService.selectWmStockTakingResultByResultId(resultId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增库存盘点结果
|
||||
*/
|
||||
@ApiOperation("新增库存盘点结果接口")
|
||||
@PreAuthorize("@ss.hasPermi('wm:stocktakingresult:add')")
|
||||
@Log(title = "库存盘点结果", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody WmStockTakingResult wmStockTakingResult)
|
||||
{
|
||||
return toAjax(wmStockTakingResultService.insertWmStockTakingResult(wmStockTakingResult));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改库存盘点结果
|
||||
*/
|
||||
@ApiOperation("修改库存盘点结果接口")
|
||||
@PreAuthorize("@ss.hasPermi('wm:stocktakingresult:edit')")
|
||||
@Log(title = "库存盘点结果", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody WmStockTakingResult wmStockTakingResult)
|
||||
{
|
||||
return toAjax(wmStockTakingResultService.updateWmStockTakingResult(wmStockTakingResult));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除库存盘点结果
|
||||
*/
|
||||
@ApiOperation("删除库存盘点结果接口")
|
||||
@PreAuthorize("@ss.hasPermi('wm:stocktakingresult:remove')")
|
||||
@Log(title = "库存盘点结果", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{resultIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] resultIds)
|
||||
{
|
||||
return toAjax(wmStockTakingResultService.deleteWmStockTakingResultByResultIds(resultIds));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,194 @@
|
||||
package com.ktg.mes.wm.controller.mobile;
|
||||
|
||||
import com.ktg.common.annotation.Log;
|
||||
import com.ktg.common.core.controller.BaseController;
|
||||
import com.ktg.common.core.domain.AjaxResult;
|
||||
import com.ktg.common.core.page.TableDataInfo;
|
||||
import com.ktg.common.enums.BusinessType;
|
||||
import com.ktg.common.utils.StringUtils;
|
||||
import com.ktg.common.utils.poi.ExcelUtil;
|
||||
import com.ktg.mes.wm.domain.*;
|
||||
import com.ktg.mes.wm.service.*;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
@Api("转移调拨明细")
|
||||
@RestController
|
||||
@RequestMapping("/mobile/wm/transferline")
|
||||
public class WmTransferLineMobController extends BaseController {
|
||||
@Autowired
|
||||
private IWmTransferLineService wmTransferLineService;
|
||||
|
||||
@Autowired
|
||||
private IWmWarehouseService wmWarehouseService;
|
||||
|
||||
@Autowired
|
||||
private IWmStorageLocationService wmStorageLocationService;
|
||||
|
||||
@Autowired
|
||||
private IWmStorageAreaService wmStorageAreaService;
|
||||
|
||||
@Autowired
|
||||
private IWmMaterialStockService wmMaterialStockService;
|
||||
|
||||
/**
|
||||
* 查询转移单行列表
|
||||
*/
|
||||
@ApiOperation("查询转移调拨单明细清单接口")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:transferline:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(WmTransferLine wmTransferLine)
|
||||
{
|
||||
startPage();
|
||||
List<WmTransferLine> list = wmTransferLineService.selectWmTransferLineList(wmTransferLine);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取转移单行详细信息
|
||||
*/
|
||||
@ApiOperation("获取转移调拨单明细详情接口")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:transferline:query')")
|
||||
@GetMapping(value = "/{lineId}")
|
||||
public AjaxResult getInfo(@PathVariable("lineId") Long lineId)
|
||||
{
|
||||
return AjaxResult.success(wmTransferLineService.selectWmTransferLineByLineId(lineId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增转移单行
|
||||
*/
|
||||
@ApiOperation("新增转移调拨单明细信息接口")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:transferline:add')")
|
||||
@Log(title = "转移单行", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody WmTransferLine wmTransferLine)
|
||||
{
|
||||
if(StringUtils.isNotNull(wmTransferLine.getMaterialStockId())){
|
||||
WmMaterialStock stock = wmMaterialStockService.selectWmMaterialStockByMaterialStockId(wmTransferLine.getMaterialStockId());
|
||||
wmTransferLine.setItemId(stock.getItemId());
|
||||
wmTransferLine.setItemCode(stock.getItemCode());
|
||||
wmTransferLine.setItemName(stock.getItemName());
|
||||
wmTransferLine.setSpecification(stock.getSpecification());
|
||||
wmTransferLine.setUnitOfMeasure(stock.getUnitOfMeasure());
|
||||
wmTransferLine.setBatchCode(stock.getBatchCode());
|
||||
wmTransferLine.setVendorId(stock.getVendorId());
|
||||
wmTransferLine.setVendorCode(stock.getVendorCode());
|
||||
wmTransferLine.setVendorName(stock.getVendorName());
|
||||
wmTransferLine.setVendorNick(stock.getVendorNick());
|
||||
wmTransferLine.setWorkorderId(stock.getWorkorderId());
|
||||
wmTransferLine.setWorkorderCode(stock.getWorkorderCode());
|
||||
}
|
||||
|
||||
if(StringUtils.isNotNull(wmTransferLine.getFromWarehouseId())){
|
||||
WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmTransferLine.getFromWarehouseId());
|
||||
wmTransferLine.setFromWarehouseCode(warehouse.getWarehouseCode());
|
||||
wmTransferLine.setFromWarehouseName(warehouse.getWarehouseName());
|
||||
}
|
||||
if(StringUtils.isNotNull(wmTransferLine.getFromLocationId())){
|
||||
WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmTransferLine.getFromLocationId());
|
||||
wmTransferLine.setFromLocationCode(location.getLocationCode());
|
||||
wmTransferLine.setFromLocationName(location.getLocationName());
|
||||
}
|
||||
if(StringUtils.isNotNull(wmTransferLine.getFromAreaId())){
|
||||
WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmTransferLine.getFromAreaId());
|
||||
wmTransferLine.setFromAreaCode(area.getAreaCode());
|
||||
wmTransferLine.setFromAreaName(area.getAreaName());
|
||||
}
|
||||
if(StringUtils.isNotNull(wmTransferLine.getToWarehouseId())){
|
||||
WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmTransferLine.getToWarehouseId());
|
||||
wmTransferLine.setToWarehouseCode(warehouse.getWarehouseCode());
|
||||
wmTransferLine.setToWarehouseName(warehouse.getWarehouseName());
|
||||
}
|
||||
if(StringUtils.isNotNull(wmTransferLine.getFromLocationId())){
|
||||
WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmTransferLine.getToLocationId());
|
||||
wmTransferLine.setToLocationCode(location.getLocationCode());
|
||||
wmTransferLine.setToLocationName(location.getLocationName());
|
||||
}
|
||||
if(StringUtils.isNotNull(wmTransferLine.getFromAreaId())){
|
||||
WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmTransferLine.getToAreaId());
|
||||
wmTransferLine.setToAreaCode(area.getAreaCode());
|
||||
wmTransferLine.setToAreaName(area.getAreaName());
|
||||
}
|
||||
wmTransferLine.setCreateBy(getUsername());
|
||||
wmTransferLineService.insertWmTransferLine(wmTransferLine);
|
||||
return AjaxResult.success(wmTransferLine);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改转移单行
|
||||
*/
|
||||
@ApiOperation("编辑转移调拨单明细信息接口")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:transferline:edit')")
|
||||
@Log(title = "转移单行", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody WmTransferLine wmTransferLine)
|
||||
{
|
||||
if(StringUtils.isNotNull(wmTransferLine.getMaterialStockId())){
|
||||
WmMaterialStock stock = wmMaterialStockService.selectWmMaterialStockByMaterialStockId(wmTransferLine.getMaterialStockId());
|
||||
wmTransferLine.setItemId(stock.getItemId());
|
||||
wmTransferLine.setItemCode(stock.getItemCode());
|
||||
wmTransferLine.setItemName(stock.getItemName());
|
||||
wmTransferLine.setSpecification(stock.getSpecification());
|
||||
wmTransferLine.setUnitOfMeasure(stock.getUnitOfMeasure());
|
||||
wmTransferLine.setBatchCode(stock.getBatchCode());
|
||||
wmTransferLine.setVendorId(stock.getVendorId());
|
||||
wmTransferLine.setVendorCode(stock.getVendorCode());
|
||||
wmTransferLine.setVendorName(stock.getVendorName());
|
||||
wmTransferLine.setVendorNick(stock.getVendorNick());
|
||||
wmTransferLine.setWorkorderId(stock.getWorkorderId());
|
||||
wmTransferLine.setWorkorderCode(stock.getWorkorderCode());
|
||||
}
|
||||
|
||||
if(StringUtils.isNotNull(wmTransferLine.getFromWarehouseId())){
|
||||
WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmTransferLine.getFromWarehouseId());
|
||||
wmTransferLine.setFromWarehouseCode(warehouse.getWarehouseCode());
|
||||
wmTransferLine.setFromWarehouseName(warehouse.getWarehouseName());
|
||||
}
|
||||
if(StringUtils.isNotNull(wmTransferLine.getFromLocationId())){
|
||||
WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmTransferLine.getFromLocationId());
|
||||
wmTransferLine.setFromLocationCode(location.getLocationCode());
|
||||
wmTransferLine.setFromLocationName(location.getLocationName());
|
||||
}
|
||||
if(StringUtils.isNotNull(wmTransferLine.getFromAreaId())){
|
||||
WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmTransferLine.getFromAreaId());
|
||||
wmTransferLine.setFromAreaCode(area.getAreaCode());
|
||||
wmTransferLine.setFromAreaName(area.getAreaName());
|
||||
}
|
||||
if(StringUtils.isNotNull(wmTransferLine.getToWarehouseId())){
|
||||
WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmTransferLine.getToWarehouseId());
|
||||
wmTransferLine.setToWarehouseCode(warehouse.getWarehouseCode());
|
||||
wmTransferLine.setToWarehouseName(warehouse.getWarehouseName());
|
||||
}
|
||||
if(StringUtils.isNotNull(wmTransferLine.getFromLocationId())){
|
||||
WmStorageLocation location = wmStorageLocationService.selectWmStorageLocationByLocationId(wmTransferLine.getToLocationId());
|
||||
wmTransferLine.setToLocationCode(location.getLocationCode());
|
||||
wmTransferLine.setToLocationName(location.getLocationName());
|
||||
}
|
||||
if(StringUtils.isNotNull(wmTransferLine.getFromAreaId())){
|
||||
WmStorageArea area = wmStorageAreaService.selectWmStorageAreaByAreaId(wmTransferLine.getToAreaId());
|
||||
wmTransferLine.setToAreaCode(area.getAreaCode());
|
||||
wmTransferLine.setToAreaName(area.getAreaName());
|
||||
}
|
||||
return toAjax(wmTransferLineService.updateWmTransferLine(wmTransferLine));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除转移单行
|
||||
*/
|
||||
@ApiOperation("删除转移调拨单明细信息接口")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:transferline:remove')")
|
||||
@Log(title = "转移单行", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{lineIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] lineIds)
|
||||
{
|
||||
return toAjax(wmTransferLineService.deleteWmTransferLineByLineIds(lineIds));
|
||||
}
|
||||
}
|
@ -0,0 +1,185 @@
|
||||
package com.ktg.mes.wm.controller.mobile;
|
||||
|
||||
import com.ktg.common.annotation.Log;
|
||||
import com.ktg.common.constant.UserConstants;
|
||||
import com.ktg.common.core.controller.BaseController;
|
||||
import com.ktg.common.core.domain.AjaxResult;
|
||||
import com.ktg.common.core.page.TableDataInfo;
|
||||
import com.ktg.common.enums.BusinessType;
|
||||
import com.ktg.common.utils.StringUtils;
|
||||
import com.ktg.common.utils.poi.ExcelUtil;
|
||||
import com.ktg.mes.wm.domain.WmTransfer;
|
||||
import com.ktg.mes.wm.domain.WmTransferLine;
|
||||
import com.ktg.mes.wm.domain.WmWarehouse;
|
||||
import com.ktg.mes.wm.domain.tx.TransferTxBean;
|
||||
import com.ktg.mes.wm.service.IStorageCoreService;
|
||||
import com.ktg.mes.wm.service.IWmTransferLineService;
|
||||
import com.ktg.mes.wm.service.IWmTransferService;
|
||||
import com.ktg.mes.wm.service.IWmWarehouseService;
|
||||
import com.ktg.system.strategy.AutoCodeUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
@Api("转移调拨")
|
||||
@RestController
|
||||
@RequestMapping("/mobile/wm/transfer")
|
||||
public class WmTransferMobController extends BaseController {
|
||||
@Autowired
|
||||
private IWmTransferService wmTransferService;
|
||||
|
||||
@Autowired
|
||||
private IWmTransferLineService wmTransferLineService;
|
||||
|
||||
@Autowired
|
||||
private IWmWarehouseService wmWarehouseService;
|
||||
|
||||
@Autowired
|
||||
private IStorageCoreService storageCoreService;
|
||||
|
||||
@Autowired
|
||||
private AutoCodeUtil autoCodeUtil;
|
||||
|
||||
/**
|
||||
* 查询转移单列表
|
||||
*/
|
||||
@ApiOperation("查询转移调拨单清单列表")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:transfer:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(WmTransfer wmTransfer)
|
||||
{
|
||||
startPage();
|
||||
List<WmTransfer> list = wmTransferService.selectWmTransferList(wmTransfer);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取转移单详细信息
|
||||
*/
|
||||
@ApiOperation("获取转移调拨单详情接口")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:transfer:query')")
|
||||
@GetMapping(value = "/{transferId}")
|
||||
public AjaxResult getInfo(@PathVariable("transferId") Long transferId)
|
||||
{
|
||||
return AjaxResult.success(wmTransferService.selectWmTransferByTransferId(transferId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增转移单
|
||||
*/
|
||||
@ApiOperation("新增转移调拨单基本信息接口")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:transfer:add')")
|
||||
@Log(title = "转移单", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody WmTransfer wmTransfer)
|
||||
{
|
||||
if(StringUtils.isNotNull(wmTransfer.getTransferCode())){
|
||||
if(UserConstants.NOT_UNIQUE.equals(wmTransferService.checkUnique(wmTransfer))){
|
||||
return AjaxResult.error("单据编号已存在");
|
||||
}
|
||||
}else {
|
||||
wmTransfer.setTransferCode(autoCodeUtil.genSerialCode(UserConstants.TRANSFER_CODE,""));
|
||||
}
|
||||
|
||||
if(StringUtils.isNotNull(wmTransfer.getFromWarehouseId())){
|
||||
WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmTransfer.getFromWarehouseId());
|
||||
wmTransfer.setFromWarehouseCode(warehouse.getWarehouseCode());
|
||||
wmTransfer.setFromWarehouseName(warehouse.getWarehouseName());
|
||||
}
|
||||
if(StringUtils.isNotNull(wmTransfer.getToWarehouseId())){
|
||||
WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmTransfer.getToWarehouseId());
|
||||
wmTransfer.setToWarehouseCode(warehouse.getWarehouseCode());
|
||||
wmTransfer.setToWarehouseName(warehouse.getWarehouseName());
|
||||
}
|
||||
|
||||
wmTransfer.setCreateBy(getUsername());
|
||||
wmTransferService.insertWmTransfer(wmTransfer);
|
||||
return AjaxResult.success(wmTransfer);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改转移单
|
||||
*/
|
||||
@ApiOperation("编辑转移调拨单基本信息接口")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:transfer:edit')")
|
||||
@Log(title = "转移单", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody WmTransfer wmTransfer)
|
||||
{
|
||||
if(UserConstants.NOT_UNIQUE.equals(wmTransferService.checkUnique(wmTransfer))){
|
||||
return AjaxResult.error("转移单编号已存在");
|
||||
}
|
||||
if(StringUtils.isNotNull(wmTransfer.getFromWarehouseId())){
|
||||
WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmTransfer.getFromWarehouseId());
|
||||
wmTransfer.setFromWarehouseCode(warehouse.getWarehouseCode());
|
||||
wmTransfer.setFromWarehouseName(warehouse.getWarehouseName());
|
||||
}
|
||||
if(StringUtils.isNotNull(wmTransfer.getToWarehouseId())){
|
||||
WmWarehouse warehouse = wmWarehouseService.selectWmWarehouseByWarehouseId(wmTransfer.getToWarehouseId());
|
||||
wmTransfer.setToWarehouseCode(warehouse.getWarehouseCode());
|
||||
wmTransfer.setToWarehouseName(warehouse.getWarehouseName());
|
||||
}
|
||||
return toAjax(wmTransferService.updateWmTransfer(wmTransfer));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除转移单
|
||||
*/
|
||||
@ApiOperation("删除转移调拨单接口")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:transfer:remove')")
|
||||
@Log(title = "转移单", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{transferIds}")
|
||||
@Transactional
|
||||
public AjaxResult remove(@PathVariable Long[] transferIds)
|
||||
{
|
||||
for (Long transferId:transferIds
|
||||
) {
|
||||
WmTransfer transfer = wmTransferService.selectWmTransferByTransferId(transferId);
|
||||
if(!UserConstants.ORDER_STATUS_PREPARE.equals(transfer.getStatus())){
|
||||
return AjaxResult.error("只能删除草稿状态单据!");
|
||||
}
|
||||
|
||||
wmTransferLineService.deleteByTransferId(transferId);
|
||||
}
|
||||
return toAjax(wmTransferService.deleteWmTransferByTransferIds(transferIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行转移
|
||||
*/
|
||||
@ApiOperation("执行转移调拨接口")
|
||||
@PreAuthorize("@ss.hasPermi('mes:wm:transfer:edit')")
|
||||
@Log(title = "转移单", businessType = BusinessType.UPDATE)
|
||||
@Transactional
|
||||
@PutMapping("/{transferId}")
|
||||
public AjaxResult execute(@PathVariable Long transferId){
|
||||
WmTransfer transfer = wmTransferService.selectWmTransferByTransferId(transferId);
|
||||
|
||||
WmTransferLine param = new WmTransferLine();
|
||||
param.setTransferId(transferId);
|
||||
List<WmTransferLine> lines = wmTransferLineService.selectWmTransferLineList(param);
|
||||
if(CollectionUtils.isEmpty(lines)){
|
||||
return AjaxResult.error("请添加需要转移的物资!");
|
||||
}
|
||||
|
||||
List<TransferTxBean> beans = wmTransferService.getTxBeans(transferId);
|
||||
|
||||
if(CollectionUtils.isEmpty(beans)){
|
||||
return AjaxResult.error("请添加转移单行信息!");
|
||||
}
|
||||
|
||||
storageCoreService.processTransfer(beans);
|
||||
|
||||
|
||||
transfer.setStatus(UserConstants.ORDER_STATUS_FINISHED);
|
||||
wmTransferService.updateWmTransfer(transfer);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user