WMS:根据采购订单和销售订单的绑定关系逻辑修改:
1、Web原材料出库审核
2、PDA人工移库和人工合库接口
3、PDA盘库接口
master
xs 6 months ago
parent 9d0c2c833f
commit 4f8cc9c7b1

@ -72,7 +72,7 @@ public class WmsApiController extends BaseController {
/**
*
* wcs
*/
// @RequiresPermissions("wms:mobile:addrawinstock")
@Log(title = "原材料出库记录", businessType = BusinessType.APPLY)
@ -143,7 +143,7 @@ public class WmsApiController extends BaseController {
}
/**
*
* wcs
*/
@Log(title = "原材料返库记录", businessType = BusinessType.APPLY)
@PostMapping(("/applyRawBack"))

@ -29,7 +29,7 @@ import com.hw.common.core.web.page.TableDataInfo;
* @date 2023-12-20
*/
@RestController
@RequestMapping("/wmscheck")
@RequestMapping("/inventoryCheck")
public class WmsInventoryCheckController extends BaseController
{
@Autowired
@ -38,7 +38,7 @@ public class WmsInventoryCheckController extends BaseController
/**
*
*/
@RequiresPermissions("wms:wmscheck:list")
@RequiresPermissions("wms:inventoryCheck:list")
@GetMapping("/list")
public TableDataInfo list(WmsInventoryCheck wmsInventoryCheck)
{
@ -50,7 +50,7 @@ public class WmsInventoryCheckController extends BaseController
/**
*
*/
@RequiresPermissions("wms:wmscheck:export")
@RequiresPermissions("wms:inventoryCheck:export")
@Log(title = "盘点记录", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, WmsInventoryCheck wmsInventoryCheck)
@ -63,7 +63,7 @@ public class WmsInventoryCheckController extends BaseController
/**
*
*/
@RequiresPermissions("wms:wmscheck:query")
@RequiresPermissions("wms:inventoryCheck:query")
@GetMapping(value = "/{inventoryCheckId}")
public AjaxResult getInfo(@PathVariable("inventoryCheckId") Long inventoryCheckId)
{
@ -84,7 +84,7 @@ public class WmsInventoryCheckController extends BaseController
/**
*
*/
@RequiresPermissions("wms:wmscheck:edit")
@RequiresPermissions("wms:inventoryCheck:edit")
@Log(title = "盘点记录", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WmsInventoryCheck wmsInventoryCheck)
@ -95,7 +95,7 @@ public class WmsInventoryCheckController extends BaseController
/**
*
*/
@RequiresPermissions("wms:wmscheck:remove")
@RequiresPermissions("wms:inventoryCheck:remove")
@Log(title = "盘点记录", businessType = BusinessType.DELETE)
@DeleteMapping("/{inventoryCheckIds}")
public AjaxResult remove(@PathVariable Long[] inventoryCheckIds)

@ -198,9 +198,9 @@ public class WmsMobileController extends BaseController {
@GetMapping("/getAuditPassRawReturns")
public TableDataInfo getAuditPassRawReturns(WmsRawReturnDetail wmsRawReturnDetail) {
startPage();
WmsRawReturn wmsRawReturn = new WmsRawReturn();
wmsRawReturn.setAuditStatus(WmsConstants.WMS_AUDIT_STATUS_PASS);
wmsRawReturn.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_NOT_FINISH);
List<WmsRawReturn> list = wmsRawReturnService.selectWmsRawReturnJoinList(wmsRawReturn);
return getDataTable(list);
}
@ -349,7 +349,7 @@ public class WmsMobileController extends BaseController {
queryProductOutstock.setOperationType(WmsConstants.WMS_OPERATION_TYPE_MANUAL);
queryProductOutstock.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_NOT_FINISH);
queryProductOutstock.setProductType(WmsConstants.WMS_PRODUCT_OUTSTOCK_PRODUCT_TYPE_PRODUCT);
List list = wmsProductOutstockService.selectWmsProductOutstockJoinList(queryProductOutstock);
List<WmsProductOutstock> list = wmsProductOutstockService.selectWmsProductOutstockJoinList(queryProductOutstock);
return getDataTable(list);
}

@ -29,7 +29,7 @@ import com.hw.common.core.web.page.TableDataInfo;
* @date 2023-12-25
*/
@RestController
@RequestMapping("/productinstock")
@RequestMapping("/productInstock")
public class WmsProductInstockController extends BaseController
{
@Autowired
@ -38,7 +38,7 @@ public class WmsProductInstockController extends BaseController
/**
* ;
*/
@RequiresPermissions("wms:productinstock:list")
@RequiresPermissions("wms:productInstock:list")
@GetMapping("/list")
public TableDataInfo list(WmsProductInstock wmsProductInstock)
{
@ -50,7 +50,7 @@ public class WmsProductInstockController extends BaseController
/**
* ;
*/
@RequiresPermissions("wms:productinstock:export")
@RequiresPermissions("wms:productInstock:export")
@Log(title = "成品入库记录;成品入库记录", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, WmsProductInstock wmsProductInstock)
@ -63,7 +63,7 @@ public class WmsProductInstockController extends BaseController
/**
* ;
*/
@RequiresPermissions("wms:productinstock:query")
@RequiresPermissions("wms:productInstock:query")
@GetMapping(value = "/{productInstockId}")
public AjaxResult getInfo(@PathVariable("productInstockId") Long productInstockId)
{
@ -73,7 +73,7 @@ public class WmsProductInstockController extends BaseController
/**
* ;
*/
@RequiresPermissions("wms:productinstock:add")
@RequiresPermissions("wms:productInstock:add")
@Log(title = "成品入库记录;成品入库记录", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WmsProductInstock wmsProductInstock)
@ -84,7 +84,7 @@ public class WmsProductInstockController extends BaseController
/**
* ;
*/
@RequiresPermissions("wms:productinstock:edit")
@RequiresPermissions("wms:productInstock:edit")
@Log(title = "成品入库记录;成品入库记录", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WmsProductInstock wmsProductInstock)
@ -95,7 +95,7 @@ public class WmsProductInstockController extends BaseController
/**
* ;
*/
@RequiresPermissions("wms:productinstock:remove")
@RequiresPermissions("wms:productInstock:remove")
@Log(title = "成品入库记录;成品入库记录", businessType = BusinessType.DELETE)
@DeleteMapping("/{productInstockIds}")
public AjaxResult remove(@PathVariable Long[] productInstockIds)

@ -46,6 +46,9 @@ public class WmsRawOutstock extends BaseEntity {
@Excel(name = "库位编码;移库和合库时需要保存")
private String locationCode;
private Long stockTotalId;
/**
* ID,pd_base_order_infoorder_id
*/
@ -253,6 +256,14 @@ public class WmsRawOutstock extends BaseEntity {
return locationCode;
}
public Long getStockTotalId() {
return stockTotalId;
}
public void setStockTotalId(Long stockTotalId) {
this.stockTotalId = stockTotalId;
}
public void setOrderId(Long orderId) {
this.orderId = orderId;
}

@ -90,7 +90,7 @@ public interface WmsProductStockMapper
/**
* totalAmount>0
* totalAmount>0,join materialwarehouse
*
* @param wmsProductStock
* @return
@ -115,4 +115,12 @@ public interface WmsProductStockMapper
public List<WmsProductStock> selectWmsProductStocksBySaleorder(WmsProductStock wmsProductStock);
/**
* totalAmount>0
*
* @param wmsProductStock
* @return
*/
public List<WmsProductStock> selectOnlyWmsProductStockInList(WmsProductStock wmsProductStock);
}

@ -85,7 +85,7 @@ public interface WmsRawStockMapper {
public List<WmsRawStock> selectWmsRawStocks4Apply(WmsRawStock wmsRawStock);
/**
* totalAmount>0
* totalAmount>0,join materialwarehouse
*
* @param wmsRawStock
* @return
@ -93,4 +93,11 @@ public interface WmsRawStockMapper {
public List<WmsRawStock> selectWmsRawStockInList(WmsRawStock wmsRawStock);
/**
* totalAmount>0
*
* @param wmsRawStock
* @return
*/
public List<WmsRawStock> selectOnlyWmsRawStockInList(WmsRawStock wmsRawStock);
}

@ -148,13 +148,16 @@ public class WmsInventoryCheckServiceImpl implements IWmsInventoryCheckService {
queryRawStock.setLocationCode(locationCode);
List<WmsRawStock> wmsRawStocks = wmsRawStockMapper.selectWmsRawStockInList(queryRawStock);
if (wmsRawStocks != null && !wmsRawStocks.isEmpty()) {
for (WmsRawStock wmsRawStock : wmsRawStocks) {
//需要根据materialid过滤聚合盘点是盘点某个物料不能按物料条码进行盘点
Map<Long, List<WmsRawStock>> wmsRawStockMap = wmsRawStocks.stream()
.collect(Collectors.groupingBy(WmsRawStock::getMaterialId));
for (Long materialId : wmsRawStockMap.keySet()) {
WmsInventoryCheckDetail wmsInventoryCheckDetail = new WmsInventoryCheckDetail();
wmsInventoryCheckDetail.setMaterialId(wmsRawStock.getMaterialId());
wmsInventoryCheckDetail.setMaterialBatch(wmsRawStock.getInstockBatch());
wmsInventoryCheckDetail.setMaterialId(materialId);
wmsInventoryCheckDetail.setInventoryTime(0L);
wmsInventoryCheckDetail.setStockType(WmsConstants.RWA_STOCK_STOCK_TYPE_RAW);
wmsInventoryCheckDetail.setStockId(wmsRawStock.getRawStockId());
// wmsInventoryCheckDetail.setStockId(wmsRawStock.getRawStockId());
wmsInventoryCheckDetail.setLocationCode(locationCode);
wmsInventoryCheckDetail.setCheckStatus(WmsConstants.WMS_INVENTORY_CHECK_DETAIL_STATUS_INVENTORYING);
wmsInventoryCheckDetail.setCreateDate(currentDate);
@ -162,7 +165,8 @@ public class WmsInventoryCheckServiceImpl implements IWmsInventoryCheckService {
wmsInventoryCheckDetail.setInventoryCheckId(toSetInventoryCheckId);
wmsInventoryCheckDetails.add(wmsInventoryCheckDetail);
}
} else {//如果库位没有库存也要增加数据
} else {//如果库位没有库存也要增加数据,用来判断所有库位是否已盘点完成
WmsInventoryCheckDetail wmsInventoryCheckDetail = new WmsInventoryCheckDetail();
wmsInventoryCheckDetail.setInventoryTime(0L);
wmsInventoryCheckDetail.setLocationCode(locationCode);
@ -178,12 +182,17 @@ public class WmsInventoryCheckServiceImpl implements IWmsInventoryCheckService {
queryProductStock.setLocationCode(locationCode);
List<WmsProductStock> wmsProductStocks = wmsProductStockMapper.selectWmsProductStockInList(queryProductStock);
if (wmsProductStocks != null && !wmsProductStocks.isEmpty()) {
for (WmsProductStock wmsProductStock : wmsProductStocks) {
//需要根据materialid过滤聚合盘点是盘点某个物料不能按物料条码进行盘点
Map<Long, List<WmsProductStock>> wmsProductStockMap = wmsProductStocks.stream()
.collect(Collectors.groupingBy(WmsProductStock::getProductId));
for (Long productId : wmsProductStockMap.keySet()) {
List<WmsProductStock> wmsProductStockList = wmsProductStockMap.get(productId);
WmsProductStock wmsProductStock = wmsProductStockList.get(0);
WmsInventoryCheckDetail wmsInventoryCheckDetail = new WmsInventoryCheckDetail();
wmsInventoryCheckDetail.setMaterialId(wmsProductStock.getProductId());
wmsInventoryCheckDetail.setMaterialBatch(wmsProductStock.getProductBatch());
wmsInventoryCheckDetail.setMaterialId(productId);
// wmsInventoryCheckDetail.setMaterialBatch(wmsProductStock.getProductBatch());
wmsInventoryCheckDetail.setStockType(wmsProductStock.getStockType());
wmsInventoryCheckDetail.setStockId(wmsProductStock.getProductStockId());
// wmsInventoryCheckDetail.setStockId(wmsProductStock.getProductStockId());
wmsInventoryCheckDetail.setInventoryTime(0L);
wmsInventoryCheckDetail.setLocationCode(locationCode);
wmsInventoryCheckDetail.setCheckStatus(WmsConstants.WMS_INVENTORY_CHECK_DETAIL_STATUS_INVENTORYING);
@ -192,7 +201,8 @@ public class WmsInventoryCheckServiceImpl implements IWmsInventoryCheckService {
wmsInventoryCheckDetail.setInventoryCheckId(toSetInventoryCheckId);
wmsInventoryCheckDetails.add(wmsInventoryCheckDetail);
}
} else {
} else {//如果库位没有库存也要增加数据,用来判断所有库位是否已盘点完成
WmsInventoryCheckDetail wmsInventoryCheckDetail = new WmsInventoryCheckDetail();
wmsInventoryCheckDetail.setInventoryTime(0L);
wmsInventoryCheckDetail.setLocationCode(locationCode);
@ -328,27 +338,40 @@ public class WmsInventoryCheckServiceImpl implements IWmsInventoryCheckService {
}
String stockType = existedInventoryCheckDetail.getStockType();
Long stockId = existedInventoryCheckDetail.getStockId();
BigDecimal realAmount = wmsInventoryCheckDetailVo.getRealAmount();
// Long stockId = existedInventoryCheckDetail.getStockId();
BigDecimal realAmount = wmsInventoryCheckDetailVo.getRealAmount();//实盘数量
Long inventoryTime = existedInventoryCheckDetail.getInventoryTime() == null ? 0L : existedInventoryCheckDetail.getInventoryTime();
existedInventoryCheckDetail.setInventoryTime(inventoryTime + 1);
existedInventoryCheckDetail.setCheckStatus(WmsConstants.WMS_INVENTORY_CHECK_DETAIL_STATUS_INVENTORYING);
if (stockId != null) {
if (stockType.equals(WmsConstants.WMS_WAREHOUSE_INSTOCK_TYPE_RAW)) {
WmsRawStock rawStock = wmsRawStockMapper.selectWmsRawStockByRawStockId(stockId);
BigDecimal stockAmount = rawStock == null ? BigDecimal.ZERO : rawStock.getTotalAmount();
existedInventoryCheckDetail.setStockAmount(stockAmount);
} else {
WmsProductStock productStock = wmsProductStockMapper.selectWmsProductStockByProductStockId(stockId);
BigDecimal stockAmount = productStock == null ? BigDecimal.ZERO : productStock.getTotalAmount();
existedInventoryCheckDetail.setStockAmount(stockAmount);
}
WmsInventoryCheck wmsInventoryCheck = wmsInventoryCheckMapper.selectWmsInventoryCheckByInventoryCheckId(existedInventoryCheckDetail.getInventoryCheckId());
//根据物料id查询库存数量
if (stockType.equals(WmsConstants.WMS_WAREHOUSE_INSTOCK_TYPE_RAW)) {
WmsRawStock queryRawStock = new WmsRawStock();
queryRawStock.setMaterialId(existedInventoryCheckDetail.getMaterialId());
queryRawStock.setWarehouseId(wmsInventoryCheck.getWarehouseId());
List<WmsRawStock> wmsRawStockInList = wmsRawStockMapper.selectOnlyWmsRawStockInList(queryRawStock);
//需要区分批次和非批次所以需要通过totalAmount相加得出此物料库存总数量
BigDecimal stockAmount = wmsRawStockInList == null || wmsRawStockInList.isEmpty() ? BigDecimal.ZERO :
wmsRawStockInList.stream()
.map(WmsRawStock::getTotalAmount)
.reduce(BigDecimal.ZERO, BigDecimal::add);
existedInventoryCheckDetail.setStockAmount(stockAmount);
} else {
if (realAmount.compareTo(BigDecimal.ZERO) > 0) {
throw new ServiceException("此库位无库存信息实际盘库数量需等于0");
}
WmsProductStock queryProductStock = new WmsProductStock();
queryProductStock.setProductId(existedInventoryCheckDetail.getMaterialId());
queryProductStock.setWarehouseId(wmsInventoryCheck.getWarehouseId());
List<WmsProductStock> wmsProductStockInList = wmsProductStockMapper.selectOnlyWmsProductStockInList(queryProductStock);
//需要区分批次和非批次所以需要通过totalAmount相加得出此物料库存总数量
BigDecimal stockAmount = wmsProductStockInList == null || wmsProductStockInList.isEmpty() ? BigDecimal.ZERO :
wmsProductStockInList.stream()
.map(WmsProductStock::getTotalAmount)
.reduce(BigDecimal.ZERO, BigDecimal::add);
existedInventoryCheckDetail.setStockAmount(stockAmount);
}
existedInventoryCheckDetail.setRealAmount(realAmount);
existedInventoryCheckDetail.setUpdateDate(new Date());
existedInventoryCheckDetail.setUpdateBy(SecurityUtils.getUsername());

@ -293,7 +293,7 @@ public class WmsMoveServiceImpl implements IWmsMoveService {
String taskCode = Seq.getId(Seq.wmsMoveSeqType, Seq.wmsMoveSeqCode);
wmsRawStocks.forEach(wmsRawStock -> {
WmsMove wmsMove = new WmsMove();
wmsMove.setInstockBatch(wmsRawStock.getInstockBatch());
wmsMove.setInstockBatch(wmsRawStock.getInstockBatch());//物料条码
wmsMove.setMaterialId(wmsRawStock.getMaterialId());
wmsMove.setWarehouseId(wmsRawStock.getWarehouseId());
wmsMove.setOriLocationCode(wmsMoveApplyVo.getOriLocationCode());
@ -412,8 +412,8 @@ public class WmsMoveServiceImpl implements IWmsMoveService {
String userName = SecurityUtils.getUsername();
Date currentDate = new Date();
String batchCode = baseBarcodeInfo.getBatchCode();
//先根据原库位编码找到需要移库的信息
WmsMove queryMove = new WmsMove();
queryMove.setTaskCode(taskCode);
// queryMove.setInstockBatch(batchCode);
@ -423,8 +423,9 @@ public class WmsMoveServiceImpl implements IWmsMoveService {
throw new ServiceException("没有此移库信息");
}
//从原库位所有需要移库的物料条码中find当前移库物料条码的信息
WmsMove wmsMove = wmsMoveList.stream().filter(move ->
move.getInstockBatch().equals(batchCode)).findFirst().get();
move.getInstockBatch().equals(materialBarcode)).findFirst().get();
if (wmsMove == null) {
throw new ServiceException("没有此移库信息");
}
@ -452,9 +453,9 @@ public class WmsMoveServiceImpl implements IWmsMoveService {
String barcodeType = baseBarcodeInfo.getBarcodeType();
if (barcodeType.equals(MesConstants.MES_BARCODE_TYPE_RAW)) {//如果是原材料
moveOutUpdateRawStock(locationCode, batchCode, applyQty, userName, currentDate);
moveOutUpdateRawStock(locationCode, materialBarcode, applyQty, userName, currentDate);
} else {//如果是成品
moveOutUpdateProductStock(locationCode, batchCode, applyQty, userName, currentDate);
moveOutUpdateProductStock(locationCode, materialBarcode, applyQty, userName, currentDate);
}
//插入移库合库明细记录
@ -531,10 +532,9 @@ public class WmsMoveServiceImpl implements IWmsMoveService {
wmsMoveMapper.updateWmsMove(wmsMove);
}
public void moveOutUpdateRawStock(String locationCode, String batchCode, BigDecimal applyQty,
public void moveOutUpdateRawStock(String locationCode, String materialBarcode, BigDecimal applyQty,
String userName, Date currentDate) {
//TODO批次码
WmsRawStock wmsRawStock = wmsRawStockMapper.selectRawStockByBarcode(batchCode);
WmsRawStock wmsRawStock = wmsRawStockMapper.selectRawStockByBarcode(materialBarcode);
if (wmsRawStock == null) {
throw new ServiceException("原库位无库存信息,不能进行移库");
}
@ -560,10 +560,10 @@ public class WmsMoveServiceImpl implements IWmsMoveService {
}
public void moveOutUpdateProductStock(String locationCode, String batchCode, BigDecimal applyQty,
public void moveOutUpdateProductStock(String locationCode, String materialBarcode, BigDecimal applyQty,
String userName, Date currentDate) {
WmsProductStock wmsProductStock = wmsProductStockMapper.selectProductStockByBatch(batchCode);
WmsProductStock wmsProductStock = wmsProductStockMapper.selectProductStockByBatch(materialBarcode);
if (wmsProductStock == null) {
throw new ServiceException("原库位无库存信息,不能进行移库");
}
@ -687,10 +687,9 @@ public class WmsMoveServiceImpl implements IWmsMoveService {
public void moveInUpdateRawStock(WmsBaseLocation location, MesBaseBarcodeInfo mesBaseBarcodeInfo,
BigDecimal applyQty, String userName, Date currentDate) {
String batchCode = mesBaseBarcodeInfo.getBatchCode();
String materialBarcode = mesBaseBarcodeInfo.getBarcodeInfo();
String locationCode = location.getLocationCode();
//todo批次码
WmsRawStock rawStock = wmsRawStockMapper.selectRawStockByBarcode(batchCode);
WmsRawStock rawStock = wmsRawStockMapper.selectRawStockByBarcode(materialBarcode);
if (rawStock != null) {
rawStock.setTotalAmount(rawStock.getTotalAmount().add(applyQty));
rawStock.setUpdateDate(currentDate);
@ -746,7 +745,6 @@ public class WmsMoveServiceImpl implements IWmsMoveService {
*
* @param wmsMove
* @param wmsMoveList
* @param oriLocation
* @param applyQty
* @param userName
* @param currentDate

@ -287,7 +287,7 @@ public class WmsProductInstockServiceImpl implements IWmsProductInstockService {
}
/**
*
* WCS
*
* @param wmsProduceInstockVo
* @return

@ -80,6 +80,9 @@ public class WmsProductOutstockServiceImpl implements IWmsProductOutstockService
String saleorderCode = wmsProductOutstock.getSaleorderCode();
Long productId = wmsProductOutstock.getProductId();
BigDecimal applyQty = wmsProductOutstock.getApplyQty();
if(applyQty.compareTo(BigDecimal.ZERO) <=0){
throw new ServiceException("申请数量需大于0");
}
WmsProductStock queryProductStock = new WmsProductStock();
queryProductStock.setWarehouseId(warehouseId);

@ -251,7 +251,7 @@ public class WmsRawInstockServiceImpl implements IWmsRawInstockService {
/**
*
* wcs
*
* @param wmsRawBackVo
*/
@ -306,7 +306,7 @@ public class WmsRawInstockServiceImpl implements IWmsRawInstockService {
wmsRawInstock.setApplyBy(SecurityUtils.getUsername());
wmsRawInstock.setApplyDate(new Date());
//wcs轮询后执行完成要更新库存
//wcs轮询后执行完成要插入库存,完整标识为否
return wmsRawInstockMapper.insertWmsRawInstock(wmsRawInstock);
}

@ -228,31 +228,34 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
throw new ServiceException("无待审核原材料出库记录");
}
//审核不通过,需要有审核意见,并且需要更新库位占用数量(解除之前占用的数量)。
//审核不通过,需要有审核意见,并且需要更新wmsStockTotal库位占用数量(解除之前占用的数量)。
if (auditStatus.equalsIgnoreCase(WmsConstants.WMS_AUDIT_STATUS_FAIL)) {
if (StringUtils.isEmpty(auditReason)) {
throw new ServiceException("请输入审核意见");
}
wmsRawOutstocks.forEach(wmsRawOutstock -> {
//todo:批次码
String locationCode = wmsRawOutstock.getLocationCode();
String instockBatch = wmsRawOutstock.getMaterialBatch();
Long stockTotalId = wmsRawOutstock.getStockTotalId();
BigDecimal planAmount = wmsRawOutstock.getOutstockAmount();
WmsRawStock wmsRawStock = wmsRawStockMapper.selectRawStockByBarcode(instockBatch);
if (wmsRawStock != null) {
BigDecimal occupyAmount = wmsRawStock.getOccupyAmount() == null ||
wmsRawStock.getOccupyAmount().compareTo(BigDecimal.ZERO) < 0 ?
BigDecimal.ZERO : wmsRawStock.getOccupyAmount();
WmsStockTotal wmsStockTotal = wmsStockTotalMapper.selectWmsStockTotalByStockTotalId(stockTotalId);
if (wmsStockTotal != null) {
BigDecimal occupyAmount = wmsStockTotal.getOccupyAmount() == null ||
wmsStockTotal.getOccupyAmount().compareTo(BigDecimal.ZERO) < 0 ?
BigDecimal.ZERO : wmsStockTotal.getOccupyAmount();
if (occupyAmount.compareTo(planAmount) >= 0) {
wmsRawStock.setOccupyAmount(occupyAmount.subtract(planAmount));
wmsRawStock.setUpdateBy(userName);
wmsRawStock.setUpdateDate(currentDate);
wmsStockTotal.setOccupyAmount(occupyAmount.subtract(planAmount));
wmsStockTotal.setUpdateBy(userName);
wmsStockTotal.setUpdateDate(currentDate);
} else {
wmsRawStock.setOccupyAmount(BigDecimal.ZERO);
wmsRawStock.setUpdateBy(userName);
wmsRawStock.setUpdateDate(currentDate);
wmsStockTotal.setOccupyAmount(BigDecimal.ZERO);
wmsStockTotal.setUpdateBy(userName);
wmsStockTotal.setUpdateDate(currentDate);
}
wmsRawStockMapper.updateWmsRawStock(wmsRawStock);
wmsStockTotalMapper.updateWmsStockTotal(wmsStockTotal);
}
});
}
@ -382,7 +385,7 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
updateRawStock(materialBarcode, outstockAmount, userName, currentDate);
//trigger中更新stocktotal的占用数量和库存数量
//rawstock的trigger中更新stocktotal的占用数量和库存数量
return 1;
}
@ -506,9 +509,9 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
: wmsRawOutstock.getTaskType();
String warehouseType = baseWarehouse.getWarehouseType();
//TODO 判断质检状态,还是在实际出库时判断质检状态
String queryQualityStatus = WmsConstants.WMS_QUALITY_STATUS_PASS;
List<WmsRawOutstock> toInsertedRawOutstocks = new ArrayList<>();
Date currentDate = new Date();
String userName = SecurityUtils.getUsername();
@ -536,7 +539,7 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
WmsRawOutstock toInsertedRawOutstock = getWmsRawOutstock(baseWarehouse, planCode, planDetailCode,
rawOutstockDetail.getMaterialId(), taskCode, taskType, wmsRawOutstock.getApplyReason(),
planAmount, currentDate, userName);
planAmount, currentDate, userName, wmsStockTotal.getStockTotalId());
toInsertedRawOutstocks.add(toInsertedRawOutstock);
} else {
@ -569,7 +572,7 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
*/
private WmsRawOutstock getWmsRawOutstock(WmsBaseWarehouse baseWarehouse,
String planCode, String planDetailCode, Long materialId, String taskCode, String taskType, String applyReason,
BigDecimal planAmount, Date currentDate, String userName) {
BigDecimal planAmount, Date currentDate, String userName, Long stockTotalId) {
//出库要求 0申请出库1申请审核出库2直接出库
String outRequirement = baseWarehouse.getOutRequirement();
String warehouseType = baseWarehouse.getWarehouseType();
@ -593,6 +596,7 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
toInsertedRawOutstock.setWarehouseId(baseWarehouse.getWarehouseId());
// toInsertedRawOutstock.setLocationCode(wmsRawStock.getLocationCode());
toInsertedRawOutstock.setStationId(SecurityUtils.getStationId());
toInsertedRawOutstock.setStockTotalId(stockTotalId);
// toInsertedRawOutstock.setPalletInfoCode(wmsRawStock.getPalletInfoCode());
toInsertedRawOutstock.setOperationType(operationType);
toInsertedRawOutstock.setApplyBy(userName);
@ -603,7 +607,7 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
toInsertedRawOutstock.setOutstockAmount(planAmount);
toInsertedRawOutstock.setPlanCode(planCode);
toInsertedRawOutstock.setPlanDetailCode(planDetailCode);
// toInsertedRawOutstock.setMaterialBatch(wmsRawStock.getInstockBatch());
// toInsertedRawOutstock.setMaterialBatch(wmsRawStock.getInstockBatch());//申请出库时不指定某个物料
toInsertedRawOutstock.setTaskType(taskType);
toInsertedRawOutstock.setCreateTime(currentDate);
toInsertedRawOutstock.setCreateBy(userName);
@ -920,6 +924,11 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
*/
@Override
public int assembleOutstock(WmsAssembleOutstockVo wmsAssembleOutstockVo) {
/**1todowcs
* 2
* 3WCS
* *
*/
String materialBarcode = wmsAssembleOutstockVo.getMaterialBarcode();
R<MesBaseBarcodeInfo> baseBarcodeInfoR = remoteMesService.getBarcode(materialBarcode, SecurityConstants.INNER);
if (baseBarcodeInfoR == null) {
@ -930,8 +939,8 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
throw new ServiceException("物料编码有误");
}
/**todo需要最终确认一下。在申请领柜体后wcs会调度agv将对应库位的柜体运输到柜体拆分区然后更新rawoutstock的materialbatch为其物料条码*/
String bindBarcode = baseBarcodeInfo.getBindBarcode();
WmsRawOutstock queryRawOutstock = new WmsRawOutstock();
queryRawOutstock.setMaterialBatch(bindBarcode);
List<WmsRawOutstock> wmsRawOutstocks = wmsRawOutstockMapper.selectWmsRawOutstockList(queryRawOutstock);
@ -947,7 +956,7 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
throw new ServiceException("没找到库存信息");
}
WmsRawStock wmsRawStock = wmsRawStocks.get(0); //待agv出库后wcs更新库存信息需要删除库存由于是1个
WmsRawStock wmsRawStock = wmsRawStocks.get(0); //todo待agv出库后wcs更新库存信息需要删除库存由于是1个
WmsRawOutstock wmsRawOutstock = new WmsRawOutstock();
wmsRawOutstock.setTaskCode(Seq.getId(Seq.rawOutstockSeqType, Seq.rawOutstockSeqCode));
@ -1118,7 +1127,7 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
wmsRawOutstock.setApplyDate(currentDate);
wmsRawOutstockMapper.insertWmsRawOutstock(wmsRawOutstock);
this.insertRawOutstockDetail(wmsRawOutstock, locationCode,materialBarcode, batchCode,
this.insertRawOutstockDetail(wmsRawOutstock, locationCode, materialBarcode, batchCode,
userName, currentDate);
directOutstockUpdateRawStock(locationCode, materialBarcode, outstockAmount, userName, currentDate);

@ -102,7 +102,7 @@ public class WmsRawReturnServiceImpl implements IWmsRawReturnService {
@Override
public WmsRawReturn selectWmsRawReturnByRawReturnId4Confirm(Long rawReturnId) {
//获取退库记录with退库记录明细列表
WmsRawReturn rawReturn = wmsRawReturnMapper.selectWmsRawReturnByRawReturnId(rawReturnId);
WmsRawReturn rawReturn = wmsRawReturnMapper.selectOnlyWmsRawReturnByRawReturnId(rawReturnId);
Long materialId = rawReturn.getMaterialId() == null ? 0L : rawReturn.getMaterialId();
Long productId = rawReturn.getProductId() == null ? 0L : rawReturn.getProductId();
Long[] rawReturnMaterialIds = {materialId, productId};
@ -133,6 +133,15 @@ public class WmsRawReturnServiceImpl implements IWmsRawReturnService {
}
/**由于wmarawreturndetail表弃用为兼容之前pda设计暂时使用wmsrawreturndetail返回数据*/
WmsRawReturnDetail wmsRawReturnDetail = new WmsRawReturnDetail();
wmsRawReturnDetail.setLocationCode(rawReturn.getLocationCode());
wmsRawReturnDetail.setMaterialBarcode(rawReturn.getMaterialBarcode());
wmsRawReturnDetail.setReturnAmount(rawReturn.getReturnAmount());
List<WmsRawReturnDetail> wmsRawReturnDetails = new ArrayList<>();
wmsRawReturnDetails.add(wmsRawReturnDetail);
rawReturn.setWmsRawReturnDetailList(wmsRawReturnDetails);
return rawReturn;
}
@ -248,7 +257,7 @@ public class WmsRawReturnServiceImpl implements IWmsRawReturnService {
throw new ServiceException("请输入审核意见");
}
WmsRawReturn wmsRawReturn = wmsRawReturnMapper.selectWmsRawReturnByRawReturnId(wmsRawReturnAuditVo.getRawReturnId());
WmsRawReturn wmsRawReturn = wmsRawReturnMapper.selectOnlyWmsRawReturnByRawReturnId(wmsRawReturnAuditVo.getRawReturnId());
wmsRawReturn.setAuditStatus(auditStatus);
wmsRawReturn.setAuditReason(auditReason);
wmsRawReturn.setAuditBy(SecurityUtils.getUsername());

@ -201,21 +201,21 @@
<select id="selectWmsProductStockInList" parameterType="WmsProductStock" resultMap="WmsProductStockResult">
<include refid="selectWmsProductStockVo"/>
<where>
<if test="warehouseId != null ">and warehouse_id = #{warehouseId}</if>
<if test="locationCode != null and locationCode != ''">and location_code = #{locationCode}</if>
<if test="stockType != null and stockType != ''">and stock_type = #{stockType}</if>
<if test="productBatch != null and productBatch != ''">and product_batch = #{productBatch}</if>
<if test="qualityStatus != null and qualityStatus != ''">and quality_status = #{qualityStatus}</if>
<if test="productId != null ">and product_id = #{productId}</if>
<if test="planCode != null ">and plan_code = #{planCode}</if>
<if test="planDetailCode != null ">and plan_detail_code = #{planDetailCode}</if>
<if test="frozenAmount != null ">and frozen_amount = #{frozenAmount}</if>
<if test="occupyAmount != null ">and occupy_amount = #{occupyAmount}</if>
<if test="createDate != null ">and create_date = #{createDate}</if>
<if test="updateDate != null ">and update_date = #{updateDate}</if>
<if test="activeFlag != null and activeFlag != ''">and active_flag = #{activeFlag}</if>
<if test="instockDate != null ">and instock_date = #{instockDate}</if>
and totalAmount>0
<if test="warehouseId != null ">and wps.warehouse_id = #{warehouseId}</if>
<if test="locationCode != null and locationCode != ''">and wps.location_code = #{locationCode}</if>
<if test="stockType != null and stockType != ''">and wps.stock_type = #{stockType}</if>
<if test="productBatch != null and productBatch != ''">and wps.product_batch = #{productBatch}</if>
<if test="qualityStatus != null and qualityStatus != ''">and wps.quality_status = #{qualityStatus}</if>
<if test="productId != null ">and wps.product_id = #{productId}</if>
<if test="planCode != null ">and wps.plan_code = #{planCode}</if>
<if test="planDetailCode != null ">and wps.plan_detail_code = #{planDetailCode}</if>
<if test="frozenAmount != null ">and wps.frozen_amount = #{frozenAmount}</if>
<if test="occupyAmount != null ">and wps.occupy_amount = #{occupyAmount}</if>
<if test="createDate != null ">and wps.create_date = #{createDate}</if>
<if test="updateDate != null ">and wps.update_date = #{updateDate}</if>
<if test="activeFlag != null and activeFlag != ''">and wps.active_flag = #{activeFlag}</if>
<if test="instockDate != null ">and wps.instock_date = #{instockDate}</if>
and wps.totalAmount>0
</where>
</select>
@ -270,6 +270,49 @@
</select>
<select id="selectOnlyWmsProductStockInList" parameterType="WmsProductStock" resultMap="WmsProductStockResult">
select wps.product_stock_id,
wps.warehouse_id,
wps.location_code,
wps.stock_type,
wps.product_batch,
wps.quality_status,
wps.product_id,
wps.plan_code,
wps.plan_detail_code,
wps.sale_order_id,
wps.saleorder_code,
wps.total_amount,
wps.frozen_amount,
wps.occupy_amount,
wps.create_by,
wps.create_date,
wps.update_by,
wps.update_date,
wps.active_flag,
wps.instock_date
from wms_product_stock wps
<where>
<if test="warehouseId != null ">and wps.warehouse_id = #{warehouseId}</if>
<if test="locationCode != null and locationCode != ''">and wps.location_code = #{locationCode}</if>
<if test="stockType != null and stockType != ''">and wps.stock_type = #{stockType}</if>
<if test="productBatch != null and productBatch != ''">and wps.product_batch = #{productBatch}</if>
<if test="qualityStatus != null and qualityStatus != ''">and wps.quality_status = #{qualityStatus}</if>
<if test="productId != null ">and wps.product_id = #{productId}</if>
<if test="planCode != null ">and wps.plan_code = #{planCode}</if>
<if test="planDetailCode != null ">and wps.plan_detail_code = #{planDetailCode}</if>
<if test="frozenAmount != null ">and wps.frozen_amount = #{frozenAmount}</if>
<if test="occupyAmount != null ">and wps.occupy_amount = #{occupyAmount}</if>
<if test="createDate != null ">and wps.create_date = #{createDate}</if>
<if test="updateDate != null ">and wps.update_date = #{updateDate}</if>
<if test="activeFlag != null and activeFlag != ''">and wps.active_flag = #{activeFlag}</if>
<if test="instockDate != null ">and wps.instock_date = #{instockDate}</if>
and wps.totalAmount>0
</where>
</select>
<!--select id="selectWmsProductStocksBySaleorder" parameterType="WmsProductStock" resultMap="WmsProductStockResult">
select wgb.warehouse_id,wgb.saleorder_code,wgb.product_id,mso.order_amount,wgb.total_amount,wgb.frozen_amount,wgb.occupy_amount,wbw.warehouse_name,mbmi.material_code,mbmi.material_name from mes_sale_order mso left join
(select wps.warehouse_id,wps.saleorder_code,wps.product_id,sum(total_amount) total_amount,sum(frozen_amount) frozen_amount,sum(occupy_amount) occupy_amount from wms_product_stock wps where wps.total_amount>0 and wps.stock_type='3'

@ -9,6 +9,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="taskCode" column="task_code" />
<result property="warehouseId" column="warehouse_id" />
<result property="locationCode" column="location_code" />
<result property="stockTotalId" column="stock_total_id" />
<result property="orderId" column="order_id" />
<result property="planCode" column="plan_code" />
<result property="planDetailCode" column="plan_detail_code" />
@ -73,7 +74,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectWmsRawOutstockVo">
select raw_outstock_id, task_code, warehouse_id, location_code, order_id, plan_code, plan_detail_code, station_id, material_id, material_batch, pallet_info_code, outstock_amount, real_outstock_amount, end_station_code, operation_type, task_type, apply_reason, audit_reason, audit_status, execute_status, apply_by, apply_date, audit_by, audit_date, update_by, update_date, begin_time, end_time, erp_status, erp_amount from wms_raw_outstock
select raw_outstock_id, task_code, warehouse_id, location_code, stock_total_id,order_id, plan_code, plan_detail_code, station_id, material_id, material_batch, pallet_info_code, outstock_amount, real_outstock_amount, end_station_code, operation_type, task_type, apply_reason, audit_reason, audit_status, execute_status, apply_by, apply_date, audit_by, audit_date, update_by, update_date, begin_time, end_time, erp_status, erp_amount from wms_raw_outstock
</sql>
<select id="selectWmsRawOutstockList" parameterType="WmsRawOutstock" resultMap="WmsRawOutstockResult">
@ -82,6 +83,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="taskCode != null and taskCode != ''"> and task_code = #{taskCode}</if>
<if test="warehouseId != null "> and warehouse_id = #{warehouseId}</if>
<if test="locationCode != null and locationCode != ''"> and location_code = #{locationCode}</if>
<if test="materialBatch != null and materialBatch != ''"> and material_batch = #{materialBatch}</if>
<if test="orderId != null "> and order_id = #{orderId}</if>
<if test="planCode != null "> and plan_code = #{planCode}</if>
<if test="planDetailCode != null "> and plan_detail_code = #{planDetailCode}</if>
@ -115,6 +117,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="taskCode != null and taskCode != ''">task_code,</if>
<if test="warehouseId != null">warehouse_id,</if>
<if test="locationCode != null">location_code,</if>
<if test="stockTotalId != null">stock_total_id,</if>
<if test="orderId != null">order_id,</if>
<if test="planCode != null">plan_code,</if>
<if test="planDetailCode != null">plan_detail_code,</if>
@ -146,6 +149,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="taskCode != null and taskCode != ''">#{taskCode},</if>
<if test="warehouseId != null">#{warehouseId},</if>
<if test="locationCode != null">#{locationCode},</if>
<if test="stockTotalId != null">#{stockTotalId},</if>
<if test="orderId != null">#{orderId},</if>
<if test="planCode != null">#{planCode},</if>
<if test="planDetailCode != null">#{planDetailCode},</if>
@ -294,9 +298,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<insert id="batchWmsRawOutstock">
insert into wms_raw_outstock(raw_outstock_id, task_code,warehouse_id,location_code,order_id,plan_code,plan_detail_code,station_id,material_id,material_batch,pallet_info_code,outstock_amount,end_station_code,operation_type,task_type,audit_status,execute_status,apply_by,apply_date,apply_reason) values
insert into wms_raw_outstock(raw_outstock_id, task_code,warehouse_id,location_code,stock_total_id,order_id,plan_code,plan_detail_code,station_id,material_id,material_batch,pallet_info_code,outstock_amount,end_station_code,operation_type,task_type,audit_status,execute_status,apply_by,apply_date,apply_reason) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.rawOutstockId}, #{item.taskCode}, #{item.warehouseId}, #{item.locationCode}, #{item.orderId}, #{item.planCode}, #{item.planDetailCode}, #{item.stationId}, #{item.materialId}, #{item.materialBatch}, #{item.palletInfoCode}, #{item.outstockAmount}, #{item.endStationCode}, #{item.operationType}, #{item.taskType}, #{item.auditStatus}, #{item.executeStatus}, #{item.applyBy}, #{item.applyDate}, #{item.applyReason})
( #{item.rawOutstockId}, #{item.taskCode}, #{item.warehouseId}, #{item.locationCode}, #{item.stockTotalId}, #{item.orderId}, #{item.planCode}, #{item.planDetailCode}, #{item.stationId}, #{item.materialId}, #{item.materialBatch}, #{item.palletInfoCode}, #{item.outstockAmount}, #{item.endStationCode}, #{item.operationType}, #{item.taskType}, #{item.auditStatus}, #{item.executeStatus}, #{item.applyBy}, #{item.applyDate}, #{item.applyReason})
</foreach>
</insert>

@ -255,7 +255,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="applyReason != null and applyReason != ''"> and wrr.apply_reason like concat('%', #{applyReason}, '%')</if>
<if test="auditReason != null and auditReason != ''"> and wrr.audit_reason like concat('%', #{auditReason}, '%')</if>
<if test="auditStatus != null and auditStatus != ''"> and wrr.audit_status = #{auditStatus}</if>
<if test="executeStatus != null and executeStatus != ''"> and wrr.execute_status = #{executeStatus}</if>
<if test="executeStatus != null and executeStatus != '' and executeStatus != 'notFinish'"> and wrr.execute_status = #{executeStatus}</if>
<if test="executeStatus != null and executeStatus != '' and executeStatus == 'notFinish'"> and (wrr.execute_status = '0' or wrr.execute_status = '1')</if>
<if test="applyBy != null and applyBy != ''"> and wrr.apply_by like concat('%', #{applyBy}, '%')</if>
<if test="auditStatus != null and auditStatus != ''"> and wrr.audit_status = #{auditStatus}</if>
</where>

@ -211,6 +211,54 @@
<select id="selectWmsRawStockInList" parameterType="WmsRawStock" resultMap="WmsRawStockResult">
<include refid="selectWmsRawStockVo"/>
<where>
<if test="warehouseId != null ">and wrs.warehouse_id = #{warehouseId}</if>
<if test="locationCode != null and locationCode != ''">and wrs.location_code = #{locationCode}</if>
<if test="stockType != null and stockType != ''">and wrs.stock_type = #{stockType}</if>
<if test="materialId != null ">and wrs.material_id = #{materialId}</if>
<if test="instockBatch != null and instockBatch != ''">and wrs.instock_batch = #{instockBatch}</if>
<if test="instockDate != null ">and wrs.instock_date = #{instockDate}</if>
<if test="lastOutstockTime != null ">and wrs.last_outstock_time = #{lastOutstockTime}</if>
<if test="qualityStatus != null and qualityStatus != ''">and wrs.quality_status = #{qualityStatus}</if>
<if test="completeFlag != null and completeFlag != ''">and wrs.complete_flag = #{completeFlag}</if>
<if test="frozenAmount != null ">and wrs.frozen_amount = #{frozenAmount}</if>
<if test="occupyAmount != null ">and wrs.occupy_amount = #{occupyAmount}</if>
<if test="supplierId != null ">and wrs.supplier_id = #{supplierId}</if>
<if test="createDate != null ">and wrs.create_date = #{createDate}</if>
<if test="updateDate != null ">and wrs.update_date = #{updateDate}</if>
<if test="activeFlag != null and activeFlag != ''">and wrs.active_flag = #{activeFlag}</if>
and wrs.total_amount > 0
</where>
</select>
<select id="selectOnlyWmsRawStockInList" parameterType="WmsRawStock" resultMap="WmsRawStockResult">
select wrs.raw_stock_id,
wrs.warehouse_id,
wrs.location_code,
wrs.stock_type,
wrs.material_id,
wrs.instock_batch,
wrs.pallet_info_code,
wrs.sale_order_id,
wrs.safe_flag,
wrs.instock_date,
wrs.last_outstock_time,
wrs.quality_status,
wrs.complete_flag,
wrs.total_amount,
wrs.frozen_amount,
wrs.occupy_amount,
wrs.supplier_id,
wrs.create_by,
wrs.create_date,
wrs.update_by,
wrs.update_date,
wrs.active_flag
from wms_raw_stock wrs
<where>
<if test="warehouseId != null ">and warehouse_id = #{warehouseId}</if>

Loading…
Cancel
Save