|
|
@ -17,6 +17,8 @@ import com.yxt.wms.biz.base.wmswarehouseinfo.WmsWarehouseInfoService; |
|
|
|
import com.yxt.wms.biz.base.wmswarehouserack.WmsHouseInfoVo; |
|
|
|
import com.yxt.wms.biz.base.wmswarehouserack.WmsWarehouseRack; |
|
|
|
import com.yxt.wms.biz.base.wmswarehouserack.WmsWarehouseRackService; |
|
|
|
import com.yxt.wms.biz.inventory.wmsansbill.WmsAnsBill; |
|
|
|
import com.yxt.wms.biz.inventory.wmsansbilldetail.WmsAnsListDetailsVo; |
|
|
|
import com.yxt.wms.biz.inventory.wmsgoodstag.WmsGoodsTag; |
|
|
|
import com.yxt.wms.biz.inventory.wmsgoodstag.WmsGoodsTagService; |
|
|
|
import com.yxt.wms.biz.inventory.wmsgoodstag.app.*; |
|
|
@ -180,6 +182,21 @@ public class WmsShelfBillService extends MybatisBaseService<WmsShelfBillMapper, |
|
|
|
sid = wmsShelfBill.getSid(); |
|
|
|
if (!list.isEmpty()) { |
|
|
|
wmsShelfBillDetailService.saveShelfDetails(sid, list); |
|
|
|
for (WmsShelfBillDetailDto detailDto : list) { |
|
|
|
BigDecimal actualCount = BigDecimal.ZERO; |
|
|
|
if (StringUtils.isNotBlank(detailDto.getCount())) { |
|
|
|
actualCount = new BigDecimal(detailDto.getCount()); |
|
|
|
} |
|
|
|
WmsReceiptBillDetail receiptBillDetail = wmsReceiptBillDetailService.fetchBySid(detailDto.getReceiptDetailSid()); |
|
|
|
if (null != receiptBillDetail) { |
|
|
|
BigDecimal shelfCount = BigDecimal.ZERO; |
|
|
|
if (null != receiptBillDetail.getShelfCount()) { |
|
|
|
shelfCount = receiptBillDetail.getShelfCount(); |
|
|
|
} |
|
|
|
receiptBillDetail.setShelfCount(shelfCount.add(actualCount)); |
|
|
|
wmsReceiptBillDetailService.updateById(receiptBillDetail); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
String applyCode = getApplyCode(dto.getCreateOrgSid()); |
|
|
|
wmsShelfBill.setBillNo(applyCode); |
|
|
@ -191,6 +208,42 @@ public class WmsShelfBillService extends MybatisBaseService<WmsShelfBillMapper, |
|
|
|
} |
|
|
|
} |
|
|
|
baseMapper.insert(wmsShelfBill); |
|
|
|
if (StringUtils.isNotBlank(dto.getSourceBillSid())) { |
|
|
|
WmsReceiptBill wmsReceiptBill = wmsReceiptBillService.fetchBySid(dto.getSourceBillSid()); |
|
|
|
List<WmsReceiptBillDetail> vos = wmsReceiptBillDetailService.selectListByBillSid(dto.getSourceBillSid()); |
|
|
|
if (!vos.isEmpty()) { |
|
|
|
HashSet<Integer> integers = new HashSet<>(); |
|
|
|
for (WmsReceiptBillDetail vo : vos) { |
|
|
|
BigDecimal count = BigDecimal.ZERO; |
|
|
|
BigDecimal actualCount = BigDecimal.ZERO; |
|
|
|
BigDecimal shelfCount = BigDecimal.ZERO; |
|
|
|
if (null != vo.getShelfCount()) { |
|
|
|
shelfCount = vo.getShelfCount(); |
|
|
|
} |
|
|
|
if (null != vo.getActualInCount()) { |
|
|
|
actualCount = vo.getActualInCount(); |
|
|
|
} |
|
|
|
count = actualCount.subtract(shelfCount); |
|
|
|
if (count.compareTo(BigDecimal.ZERO) <= 0) { |
|
|
|
integers.add(2); |
|
|
|
} else { |
|
|
|
integers.add(1); |
|
|
|
} |
|
|
|
} |
|
|
|
if (integers.size() > 1) { |
|
|
|
wmsReceiptBill.setDistributeType(2); |
|
|
|
} else { |
|
|
|
wmsReceiptBill.setDistributeType(1); |
|
|
|
for (Integer integer : integers) { |
|
|
|
if (integer == 1) { |
|
|
|
wmsReceiptBill.setDistributeType(2); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
wmsReceiptBillService.updateById(wmsReceiptBill); |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
WmsShelfBill wmsShelfBill = fetchBySid(sid); |
|
|
|
if (wmsShelfBill == null) { |
|
|
@ -209,6 +262,21 @@ public class WmsShelfBillService extends MybatisBaseService<WmsShelfBillMapper, |
|
|
|
sid = wmsShelfBill.getSid(); |
|
|
|
if (!list.isEmpty()) { |
|
|
|
wmsShelfBillDetailService.saveShelfDetails(sid, list); |
|
|
|
for (WmsShelfBillDetailDto detailDto : list) { |
|
|
|
BigDecimal actualCount = BigDecimal.ZERO; |
|
|
|
if (StringUtils.isNotBlank(detailDto.getCount())) { |
|
|
|
actualCount = new BigDecimal(detailDto.getCount()); |
|
|
|
} |
|
|
|
WmsReceiptBillDetail receiptBillDetail = wmsReceiptBillDetailService.fetchBySid(detailDto.getReceiptDetailSid()); |
|
|
|
if (null != receiptBillDetail) { |
|
|
|
BigDecimal shelfCount = BigDecimal.ZERO; |
|
|
|
if (null != receiptBillDetail.getShelfCount()) { |
|
|
|
shelfCount = receiptBillDetail.getShelfCount(); |
|
|
|
} |
|
|
|
receiptBillDetail.setShelfCount(shelfCount.add(actualCount)); |
|
|
|
wmsReceiptBillDetailService.updateById(receiptBillDetail); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(dto.getBillState())) { |
|
|
|
if (dto.getBillState().equals("0")) { |
|
|
@ -218,7 +286,41 @@ public class WmsShelfBillService extends MybatisBaseService<WmsShelfBillMapper, |
|
|
|
} |
|
|
|
} |
|
|
|
baseMapper.updateById(wmsShelfBill); |
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(dto.getSourceBillSid())) { |
|
|
|
WmsReceiptBill wmsReceiptBill = wmsReceiptBillService.fetchBySid(dto.getSourceBillSid()); |
|
|
|
List<WmsReceiptBillDetail> vos = wmsReceiptBillDetailService.selectListByBillSid(dto.getSourceBillSid()); |
|
|
|
if (!vos.isEmpty()) { |
|
|
|
HashSet<Integer> integers = new HashSet<>(); |
|
|
|
for (WmsReceiptBillDetail vo : vos) { |
|
|
|
BigDecimal count = BigDecimal.ZERO; |
|
|
|
BigDecimal actualCount = BigDecimal.ZERO; |
|
|
|
BigDecimal shelfCount = BigDecimal.ZERO; |
|
|
|
if (null != vo.getShelfCount()) { |
|
|
|
shelfCount = vo.getShelfCount(); |
|
|
|
} |
|
|
|
if (null != vo.getActualInCount()) { |
|
|
|
actualCount = vo.getActualInCount(); |
|
|
|
} |
|
|
|
count = actualCount.subtract(shelfCount); |
|
|
|
if (count.compareTo(BigDecimal.ZERO) <= 0) { |
|
|
|
integers.add(2); |
|
|
|
} else { |
|
|
|
integers.add(1); |
|
|
|
} |
|
|
|
} |
|
|
|
if (integers.size() > 1) { |
|
|
|
wmsReceiptBill.setDistributeType(2); |
|
|
|
} else { |
|
|
|
wmsReceiptBill.setDistributeType(1); |
|
|
|
for (Integer integer : integers) { |
|
|
|
if (integer == 1) { |
|
|
|
wmsReceiptBill.setDistributeType(2); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
wmsReceiptBillService.updateById(wmsReceiptBill); |
|
|
|
} |
|
|
|
} |
|
|
|
// saveWmsInventory(sid);
|
|
|
|
|
|
|
@ -392,17 +494,21 @@ public class WmsShelfBillService extends MybatisBaseService<WmsShelfBillMapper, |
|
|
|
} |
|
|
|
} |
|
|
|
//查询所有已上架的商品
|
|
|
|
List<String> stringList = wmsShelfBillDetailService.selectReceiptSidList(); |
|
|
|
stringList.removeAll(Collections.singleton(null)); |
|
|
|
// List<String> stringList = wmsShelfBillDetailService.selectReceiptSidList();
|
|
|
|
// stringList.removeAll(Collections.singleton(null));
|
|
|
|
//获取收货单据
|
|
|
|
WmsReceiptBill wmsReceiptBill = wmsReceiptBillService.fetchBySid(sid); |
|
|
|
shelfInitVo.setCreateTime(DateUtil.today());//单据日期
|
|
|
|
shelfInitVo.setSourceBillNo(wmsReceiptBill.getBillNo());//来源单编号
|
|
|
|
shelfInitVo.setSourceBillSid(wmsReceiptBill.getSid());//来源单sid
|
|
|
|
shelfInitVo.setBillState("新建"); |
|
|
|
if (StringUtils.isNotBlank(wmsReceiptBill.getManufactorBillNo())) { |
|
|
|
shelfInitVo.setManufactorBillNo(wmsReceiptBill.getManufactorBillNo()); |
|
|
|
} |
|
|
|
List<ShelfInitListVo> list = new ArrayList<>(); |
|
|
|
//获取收货单据的明细
|
|
|
|
List<WmsReceiptBillDetail> wmsReceiptBillDetailsList = wmsReceiptBillDetailService.selectByBillSid(sid, stringList); |
|
|
|
// List<WmsReceiptBillDetail> wmsReceiptBillDetailsList = wmsReceiptBillDetailService.selectByBillSid(sid, stringList);
|
|
|
|
List<WmsReceiptBillDetail> wmsReceiptBillDetailsList = wmsReceiptBillDetailService.selectListByBillSid(sid); |
|
|
|
wmsReceiptBillDetailsList.removeAll(Collections.singleton(null)); |
|
|
|
if (!wmsReceiptBillDetailsList.isEmpty()) { |
|
|
|
for (int i = 0; i < wmsReceiptBillDetailsList.size(); i++) { |
|
|
@ -411,6 +517,16 @@ public class WmsShelfBillService extends MybatisBaseService<WmsShelfBillMapper, |
|
|
|
ShelfInitListVo shelfInitListVo = new ShelfInitListVo(); |
|
|
|
BeanUtil.copyProperties(v, shelfInitListVo, "sid"); |
|
|
|
shelfInitListVo.setReceiptDetailSid(v.getSid()); |
|
|
|
BigDecimal shelfCount = BigDecimal.ZERO; |
|
|
|
if (null != v.getShelfCount()) { |
|
|
|
shelfCount = v.getShelfCount(); |
|
|
|
} |
|
|
|
BigDecimal actualInCount = BigDecimal.ZERO; |
|
|
|
if (null != v.getActualInCount()) { |
|
|
|
actualInCount = v.getActualInCount(); |
|
|
|
} |
|
|
|
BigDecimal subtract = actualInCount.subtract(shelfCount); |
|
|
|
shelfInitListVo.setCount(subtract.toString()); |
|
|
|
// shelfInitListVo.setBatchNumber(wmsReceiptBillDetailBatch.getBatchNumber());
|
|
|
|
// shelfInitListVo.setWarehouseSid(v.getWarehouseSid());
|
|
|
|
// shelfInitListVo.setWarehouseRackSid(v.getWarehouseRackSid());
|
|
|
@ -631,6 +747,9 @@ public class WmsShelfBillService extends MybatisBaseService<WmsShelfBillMapper, |
|
|
|
wmsGoodsTagService.updateById(wmsGoodsTag); |
|
|
|
} |
|
|
|
WmsInventoryRecordDto recordDto = new WmsInventoryRecordDto(); |
|
|
|
if (StringUtils.isNotBlank(wmsShelfBill.getManufactorBillNo())) { |
|
|
|
recordDto.setManufactorBillNo(wmsShelfBill.getManufactorBillNo()); |
|
|
|
} |
|
|
|
recordDto.setCreateBySid(dto.getUserSid()); |
|
|
|
recordDto.setUseOrgSid(deptSid); |
|
|
|
recordDto.setCreateOrgSid(createOrgSid); |
|
|
|