|
|
@ -11,15 +11,20 @@ import com.yxt.common.base.utils.StringUtils; |
|
|
|
import com.yxt.common.core.query.PagerQuery; |
|
|
|
import com.yxt.common.core.result.ResultBean; |
|
|
|
import com.yxt.common.core.vo.PagerVo; |
|
|
|
import com.yxt.wms.biz.base.wmswarehouserack.WmsWarehouseRack; |
|
|
|
import com.yxt.wms.biz.base.wmswarehouserack.WmsWarehouseRackService; |
|
|
|
import com.yxt.wms.biz.base.wmswarehouserack.WmsWarehouseRackVo; |
|
|
|
import com.yxt.wms.biz.inventory.wmsinventory.WmsInventory; |
|
|
|
import com.yxt.wms.biz.inventory.wmsinventory.WmsInventorySaveDto; |
|
|
|
import com.yxt.wms.biz.inventory.wmsinventory.WmsInventoryService; |
|
|
|
import com.yxt.wms.biz.inventory.wmsinventory.WmsUpdateCountQuery; |
|
|
|
import com.yxt.wms.biz.inventory.wmsinventorybatch.WmsInventoryBatch; |
|
|
|
import com.yxt.wms.biz.inventory.wmsinventorybatch.WmsInventoryBatchService; |
|
|
|
import com.yxt.wms.biz.inventory.wmsinventoryrecord.WmsInventoryRecord; |
|
|
|
import com.yxt.wms.biz.inventory.wmsinventoryrecord.WmsInventoryRecordService; |
|
|
|
import com.yxt.wms.feign.as.asbusrepairbill.AsBusrepairBill; |
|
|
|
import com.yxt.wms.feign.as.asbusrepairbill.AsBusrepairBillFeign; |
|
|
|
import com.yxt.wms.feign.as.asbusrepairinventorybilldetail.AsBusrepairInventorybillDetail; |
|
|
|
import com.yxt.wms.feign.as.asbusrepairinventorybilldetail.AsBusrepairInventorybillDetailFeign; |
|
|
|
import com.yxt.wms.feign.portal.sysorganization.SysOrganizationFeign; |
|
|
|
import com.yxt.wms.feign.portal.sysorganization.SysOrganizationVo; |
|
|
@ -57,6 +62,10 @@ public class WmsOldInventoryService extends MybatisBaseService<WmsOldInventoryMa |
|
|
|
private SysUserFeign sysUserFeign; |
|
|
|
@Autowired |
|
|
|
private AsBusrepairInventorybillDetailFeign asBusrepairInventorybillDetailFeign; |
|
|
|
@Autowired |
|
|
|
private WmsWarehouseRackService wmsWarehouseRackService; |
|
|
|
@Autowired |
|
|
|
private AsBusrepairBillFeign asBusrepairBillFeign; |
|
|
|
|
|
|
|
public PagerVo<WmsOldInventoryVo> listPage(PagerQuery<WmsOldInventoryQuery> pagerQuery) { |
|
|
|
WmsOldInventoryQuery query = pagerQuery.getParams(); |
|
|
@ -120,31 +129,40 @@ public class WmsOldInventoryService extends MybatisBaseService<WmsOldInventoryMa |
|
|
|
} |
|
|
|
List<WmsBusrepairInventorybillDetailOld> dtos = wmsOldGroundConfirm.getOldList(); |
|
|
|
for (WmsBusrepairInventorybillDetailOld wmsBusrepairInventorybillDetailOld : dtos) { |
|
|
|
WmsInventorySaveDto dto = new WmsInventorySaveDto(); |
|
|
|
dto.setCreateBySid(wmsOldGroundConfirm.getCreateBySid()); |
|
|
|
dto.setGoodsID(wmsBusrepairInventorybillDetailOld.getGoodsID()); |
|
|
|
dto.setGoodsSpuSid(wmsBusrepairInventorybillDetailOld.getGoodsSpuSid()); |
|
|
|
dto.setGoodsSpuName(wmsBusrepairInventorybillDetailOld.getGoodsSpuName()); |
|
|
|
dto.setGoodsSkuSid(wmsBusrepairInventorybillDetailOld.getGoodsSkuSid()); |
|
|
|
dto.setGoodsSkuTitle(wmsBusrepairInventorybillDetailOld.getGoodsSkuTitle()); |
|
|
|
dto.setGoodsSkuCode(wmsBusrepairInventorybillDetailOld.getGoodsSkuCode()); |
|
|
|
dto.setGoodsSkuOwnSpec(wmsBusrepairInventorybillDetailOld.getGoodsSkuOwnSpec()); |
|
|
|
dto.setManufacturerSid(wmsBusrepairInventorybillDetailOld.getManufacturerSid()); |
|
|
|
dto.setManufacturerName(wmsBusrepairInventorybillDetailOld.getManufacturerName()); |
|
|
|
dto.setUnit(wmsBusrepairInventorybillDetailOld.getUnit()); |
|
|
|
dto.setCount(wmsBusrepairInventorybillDetailOld.getCount().toString()); |
|
|
|
dto.setWarehouseSid(wmsBusrepairInventorybillDetailOld.getWarehouseSid()); |
|
|
|
dto.setWarehouseName(wmsBusrepairInventorybillDetailOld.getWarehouseName()); |
|
|
|
dto.setWarehouseRackSid(wmsBusrepairInventorybillDetailOld.getWarehouseRackSid()); |
|
|
|
dto.setWarehouseRackCode(wmsBusrepairInventorybillDetailOld.getWarehouseRackCode()); |
|
|
|
dto.setFirstInDate(DateUtil.today()); |
|
|
|
dto.setCreateOrgSid(createOrgSid); |
|
|
|
dto.setUseOrgSid(useOrgSid); |
|
|
|
String inSid = wmsInventoryService.saveWmsInventory(dto).getData(); |
|
|
|
String kcSid = wmsInventoryService.selByGoodsIdAndRackSid(wmsBusrepairInventorybillDetailOld.getGoodsID(), wmsBusrepairInventorybillDetailOld.getWarehouseRackSid()); |
|
|
|
if (StringUtils.isNotBlank(kcSid)){ |
|
|
|
WmsUpdateCountQuery wmsUpdateCountQuery = new WmsUpdateCountQuery(); |
|
|
|
wmsUpdateCountQuery.setSid(kcSid); |
|
|
|
wmsUpdateCountQuery.setCount(wmsBusrepairInventorybillDetailOld.getCount()); |
|
|
|
wmsUpdateCountQuery.setAddOrReduce(0); |
|
|
|
wmsInventoryService.updateInventoryCount(wmsUpdateCountQuery); |
|
|
|
}else { |
|
|
|
WmsInventorySaveDto dto = new WmsInventorySaveDto(); |
|
|
|
dto.setCreateBySid(wmsOldGroundConfirm.getCreateBySid()); |
|
|
|
dto.setGoodsID(wmsBusrepairInventorybillDetailOld.getGoodsID()); |
|
|
|
dto.setGoodsSpuSid(wmsBusrepairInventorybillDetailOld.getGoodsSpuSid()); |
|
|
|
dto.setGoodsSpuName(wmsBusrepairInventorybillDetailOld.getGoodsSpuName()); |
|
|
|
dto.setGoodsSkuSid(wmsBusrepairInventorybillDetailOld.getGoodsSkuSid()); |
|
|
|
dto.setGoodsSkuTitle(wmsBusrepairInventorybillDetailOld.getGoodsSkuTitle()); |
|
|
|
dto.setGoodsSkuCode(wmsBusrepairInventorybillDetailOld.getGoodsSkuCode()); |
|
|
|
dto.setGoodsSkuOwnSpec(wmsBusrepairInventorybillDetailOld.getGoodsSkuOwnSpec()); |
|
|
|
dto.setManufacturerSid(wmsBusrepairInventorybillDetailOld.getManufacturerSid()); |
|
|
|
dto.setManufacturerName(wmsBusrepairInventorybillDetailOld.getManufacturerName()); |
|
|
|
dto.setUnit(wmsBusrepairInventorybillDetailOld.getUnit()); |
|
|
|
dto.setCount(wmsBusrepairInventorybillDetailOld.getCount().toString()); |
|
|
|
dto.setWarehouseSid(wmsBusrepairInventorybillDetailOld.getWarehouseSid()); |
|
|
|
dto.setWarehouseName(wmsBusrepairInventorybillDetailOld.getWarehouseName()); |
|
|
|
dto.setWarehouseRackSid(wmsBusrepairInventorybillDetailOld.getWarehouseRackSid()); |
|
|
|
dto.setWarehouseRackCode(wmsBusrepairInventorybillDetailOld.getWarehouseRackCode()); |
|
|
|
dto.setFirstInDate(DateUtil.today()); |
|
|
|
dto.setCreateOrgSid(createOrgSid); |
|
|
|
dto.setUseOrgSid(useOrgSid); |
|
|
|
kcSid = wmsInventoryService.saveWmsInventory(dto).getData(); |
|
|
|
} |
|
|
|
//生成出入库记录
|
|
|
|
WmsInventoryRecord wmsInventoryRecord = new WmsInventoryRecord(); |
|
|
|
wmsInventoryRecord.setCreateBySid(wmsOldGroundConfirm.getCreateBySid()); |
|
|
|
wmsInventoryRecord.setInventorySid(inSid); |
|
|
|
wmsInventoryRecord.setInventorySid(kcSid); |
|
|
|
wmsInventoryRecord.setGoodsID(wmsBusrepairInventorybillDetailOld.getGoodsID()); |
|
|
|
wmsInventoryRecord.setBillType("1"); |
|
|
|
wmsInventoryRecord.setBusTypeKey("09"); |
|
|
@ -168,7 +186,7 @@ public class WmsOldInventoryService extends MybatisBaseService<WmsOldInventoryMa |
|
|
|
wmsInventoryRecord.setHandlerName(sysUserVo.getName()); |
|
|
|
wmsInventoryRecordService.save(wmsInventoryRecord); |
|
|
|
//修改维修单中对应商品旧件状态
|
|
|
|
asBusrepairInventorybillDetailFeign.updateOldBySid(wmsBusrepairInventorybillDetailOld.getSid(),wmsBusrepairInventorybillDetailOld.getGoodsID(),wmsBusrepairInventorybillDetailOld.getGoodsSkuCode(),inSid); |
|
|
|
asBusrepairInventorybillDetailFeign.updateOldBySid(wmsBusrepairInventorybillDetailOld.getSid(),wmsBusrepairInventorybillDetailOld.getGoodsID(),wmsBusrepairInventorybillDetailOld.getGoodsSkuCode(),kcSid); |
|
|
|
} |
|
|
|
return rb.success(); |
|
|
|
} |
|
|
@ -371,4 +389,86 @@ public class WmsOldInventoryService extends MybatisBaseService<WmsOldInventoryMa |
|
|
|
save(wmsOldInventory); |
|
|
|
return rb.success(); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean appSaveInventory(WmsOldGroundConfirmApp wmsOldGroundConfirm) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
String createOrgSid = sysStaffOrgFeign.getOrgSidByPath(wmsOldGroundConfirm.getOrgPath()).getData(); |
|
|
|
String useOrgSid = ""; |
|
|
|
List<String> split = Arrays.asList(wmsOldGroundConfirm.getOrgPath().split("/")); |
|
|
|
if (split.size() > 1) { |
|
|
|
//获取本级sid获取本级部门信息
|
|
|
|
SysOrganizationVo sysOrganization1 = sysOrganizationFeign.fetchBySid(split.get(split.size() - 1)).getData(); |
|
|
|
useOrgSid = sysOrganization1.getSid(); |
|
|
|
} else { |
|
|
|
SysOrganizationVo sysOrganization = sysOrganizationFeign.fetchBySid(split.get(0)).getData(); |
|
|
|
useOrgSid = sysOrganization.getSid(); |
|
|
|
} |
|
|
|
AsBusrepairBill asBusrepairBill = asBusrepairBillFeign.selectOneByBillNo(wmsOldGroundConfirm.getBillId()).getData(); |
|
|
|
List<WmsBusrepairInventorybillDetailOldApp> dtos = wmsOldGroundConfirm.getOldList(); |
|
|
|
for (WmsBusrepairInventorybillDetailOldApp wmsBusrepairInventorybillDetailOldApp : dtos) { |
|
|
|
AsBusrepairInventorybillDetail asBusrepairInventorybillDetail = asBusrepairInventorybillDetailFeign.getOldDetailsByOldGoodsId(wmsBusrepairInventorybillDetailOldApp.getGoodsID()).getData(); |
|
|
|
WmsWarehouseRack wmsWarehouseRack = wmsWarehouseRackService.fetchBySid(wmsBusrepairInventorybillDetailOldApp.getWarehouseRackCode()); |
|
|
|
String kcSid = wmsInventoryService.selByGoodsIdAndRackSid(wmsBusrepairInventorybillDetailOldApp.getGoodsID(), wmsWarehouseRack.getSid()); |
|
|
|
if (StringUtils.isNotBlank(kcSid)){ |
|
|
|
WmsUpdateCountQuery wmsUpdateCountQuery = new WmsUpdateCountQuery(); |
|
|
|
wmsUpdateCountQuery.setSid(kcSid); |
|
|
|
wmsUpdateCountQuery.setCount(wmsBusrepairInventorybillDetailOldApp.getCount()); |
|
|
|
wmsUpdateCountQuery.setAddOrReduce(0); |
|
|
|
wmsInventoryService.updateInventoryCount(wmsUpdateCountQuery); |
|
|
|
}else { |
|
|
|
WmsInventorySaveDto dto = new WmsInventorySaveDto(); |
|
|
|
dto.setCreateBySid(wmsOldGroundConfirm.getCreateBySid()); |
|
|
|
dto.setGoodsID(wmsBusrepairInventorybillDetailOldApp.getGoodsID()); |
|
|
|
dto.setGoodsSpuSid(asBusrepairInventorybillDetail.getGoodsSpuSid()); |
|
|
|
dto.setGoodsSpuName(asBusrepairInventorybillDetail.getGoodsSpuName()); |
|
|
|
dto.setGoodsSkuSid(asBusrepairInventorybillDetail.getGoodsSkuSid()); |
|
|
|
dto.setGoodsSkuTitle(asBusrepairInventorybillDetail.getGoodsSkuTitle()); |
|
|
|
dto.setGoodsSkuCode(asBusrepairInventorybillDetail.getGoodsSkuCode()); |
|
|
|
dto.setGoodsSkuOwnSpec(asBusrepairInventorybillDetail.getGoodsSkuOwnSpec()); |
|
|
|
dto.setManufacturerSid(asBusrepairInventorybillDetail.getManufacturerSid()); |
|
|
|
dto.setManufacturerName(asBusrepairInventorybillDetail.getManufacturerName()); |
|
|
|
dto.setUnit(asBusrepairInventorybillDetail.getUnit()); |
|
|
|
dto.setCount(asBusrepairInventorybillDetail.getCount().toString()); |
|
|
|
dto.setWarehouseSid(asBusrepairInventorybillDetail.getWarehouseSid()); |
|
|
|
dto.setWarehouseName(asBusrepairInventorybillDetail.getWarehouseName()); |
|
|
|
dto.setWarehouseRackSid(wmsWarehouseRack.getSid()); |
|
|
|
dto.setWarehouseRackCode(wmsWarehouseRack.getRackCode()); |
|
|
|
dto.setFirstInDate(DateUtil.today()); |
|
|
|
dto.setCreateOrgSid(createOrgSid); |
|
|
|
dto.setUseOrgSid(useOrgSid); |
|
|
|
kcSid = wmsInventoryService.saveWmsInventory(dto).getData(); |
|
|
|
} |
|
|
|
//生成出入库记录
|
|
|
|
WmsInventoryRecord wmsInventoryRecord = new WmsInventoryRecord(); |
|
|
|
wmsInventoryRecord.setCreateBySid(wmsOldGroundConfirm.getCreateBySid()); |
|
|
|
wmsInventoryRecord.setInventorySid(kcSid); |
|
|
|
wmsInventoryRecord.setSourceBillSid(asBusrepairBill.getSid()); |
|
|
|
wmsInventoryRecord.setSourceBillSid(asBusrepairBill.getBillNo()); |
|
|
|
wmsInventoryRecord.setGoodsID(wmsBusrepairInventorybillDetailOldApp.getGoodsID()); |
|
|
|
wmsInventoryRecord.setBillType("1"); |
|
|
|
wmsInventoryRecord.setBusTypeKey("09"); |
|
|
|
wmsInventoryRecord.setBusTypeValue("其他入库"); |
|
|
|
wmsInventoryRecord.setManufacturerName(asBusrepairInventorybillDetail.getManufacturerName()); |
|
|
|
wmsInventoryRecord.setGoodsSpuSid(asBusrepairInventorybillDetail.getGoodsSpuSid()); |
|
|
|
wmsInventoryRecord.setGoodsSpuName(asBusrepairInventorybillDetail.getGoodsSpuName()); |
|
|
|
wmsInventoryRecord.setGoodsSkuSid(asBusrepairInventorybillDetail.getGoodsSkuSid()); |
|
|
|
wmsInventoryRecord.setGoodsSkuTitle(asBusrepairInventorybillDetail.getGoodsSkuTitle()); |
|
|
|
wmsInventoryRecord.setGoodsSkuCode(asBusrepairInventorybillDetail.getGoodsSkuCode()); |
|
|
|
wmsInventoryRecord.setGoodsSkuOwnSpec(asBusrepairInventorybillDetail.getGoodsSkuOwnSpec()); |
|
|
|
wmsInventoryRecord.setCurrentCount(asBusrepairInventorybillDetail.getCount()); |
|
|
|
wmsInventoryRecord.setUnit(asBusrepairInventorybillDetail.getUnit()); |
|
|
|
wmsInventoryRecord.setCount(asBusrepairInventorybillDetail.getCount()); |
|
|
|
wmsInventoryRecord.setWarehouseSid(asBusrepairInventorybillDetail.getWarehouseSid()); |
|
|
|
wmsInventoryRecord.setWarehouseName(asBusrepairInventorybillDetail.getWarehouseName()); |
|
|
|
wmsInventoryRecord.setWarehouseRackSid(wmsWarehouseRack.getSid()); |
|
|
|
wmsInventoryRecord.setWarehouseRackCode(wmsWarehouseRack.getRackCode()); |
|
|
|
SysUserVo sysUserVo = sysUserFeign.fetchBySid(wmsOldGroundConfirm.getCreateBySid()).getData(); |
|
|
|
wmsInventoryRecord.setHandlerSid(wmsOldGroundConfirm.getCreateBySid()); |
|
|
|
wmsInventoryRecord.setHandlerName(sysUserVo.getName()); |
|
|
|
wmsInventoryRecordService.save(wmsInventoryRecord); |
|
|
|
//修改维修单中对应商品旧件状态
|
|
|
|
asBusrepairInventorybillDetailFeign.updateOldBySid(asBusrepairInventorybillDetail.getSid(),wmsBusrepairInventorybillDetailOldApp.getGoodsID(),asBusrepairInventorybillDetail.getGoodsSkuCode(),kcSid); |
|
|
|
} |
|
|
|
return rb.success(); |
|
|
|
} |
|
|
|
} |
|
|
|