|
|
@ -12,20 +12,17 @@ import com.yxt.common.core.result.ResultBean; |
|
|
|
import com.yxt.common.core.vo.PagerVo; |
|
|
|
import com.yxt.wms.biz.base.wmswarehouserack.WmsHouseInfoVo; |
|
|
|
import com.yxt.wms.biz.base.wmswarehouserack.WmsWarehouseRackService; |
|
|
|
import com.yxt.wms.biz.inventory.wmsansbill.WmsAnsBillVo; |
|
|
|
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.wmsinventory.WmsInventorySaveDto; |
|
|
|
import com.yxt.wms.biz.inventory.wmsinventory.WmsInventoryService; |
|
|
|
import com.yxt.wms.biz.inventory.wmsinventoryrecord.WmsInventoryRecord; |
|
|
|
import com.yxt.wms.biz.inventory.wmsinventoryrecord.WmsInventoryRecordDto; |
|
|
|
import com.yxt.wms.biz.inventory.wmsinventoryrecord.WmsInventoryRecordService; |
|
|
|
import com.yxt.wms.biz.inventory.wmsreceiptbill.WmsReceiptBill; |
|
|
|
import com.yxt.wms.biz.inventory.wmsreceiptbill.WmsReceiptBillService; |
|
|
|
import com.yxt.wms.biz.inventory.wmsreceiptbilldetail.WmsReceiptBillDetail; |
|
|
|
import com.yxt.wms.biz.inventory.wmsreceiptbilldetail.WmsReceiptBillDetailDto2; |
|
|
|
import com.yxt.wms.biz.inventory.wmsreceiptbilldetail.WmsReceiptBillDetailService; |
|
|
|
import com.yxt.wms.biz.inventory.wmsreceiptbilldetailbatch.WmsReceiptBillDetailBatch; |
|
|
|
import com.yxt.wms.biz.inventory.wmsreceiptbilldetailbatch.WmsReceiptBillDetailBatchService; |
|
|
|
import com.yxt.wms.biz.inventory.wmsshelfbill.app.*; |
|
|
|
import com.yxt.wms.biz.inventory.wmsshelfbilldetail.*; |
|
|
@ -39,6 +36,7 @@ import com.yxt.wms.feign.portal.sysuser.SysUserFeign; |
|
|
|
import com.yxt.wms.feign.portal.sysuser.SysUserVo; |
|
|
|
import com.yxt.wms.utils.BillNo; |
|
|
|
import com.yxt.wms.utils.Rule; |
|
|
|
import org.apache.ibatis.scripting.xmltags.IfSqlNode; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.context.annotation.Bean; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
@ -46,6 +44,7 @@ import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
/** |
|
|
@ -269,7 +268,7 @@ public class WmsShelfBillService extends MybatisBaseService<WmsShelfBillMapper, |
|
|
|
wmsInventoryRecordDto.setGoodsSkuSid(dto.getGoodsSkuSid()); |
|
|
|
wmsInventoryRecordDto.setGoodsSkuCode(dto.getGoodsSkuCode()); |
|
|
|
wmsInventoryRecordDto.setUnit(dto.getUnit()); |
|
|
|
wmsInventoryRecordDto.setCurrentCount(StringUtils.isNotBlank(dto.getCount()) ? new BigDecimal(dto.getCount()) : BigDecimal.ZERO); |
|
|
|
// wmsInventoryRecordDto.setCurrentCount(StringUtils.isNotBlank(dto.getCount()) ? new BigDecimal(dto.getCount()) : BigDecimal.ZERO);
|
|
|
|
wmsInventoryRecordDto.setWarehouseSid(dto.getWarehouseSid()); |
|
|
|
wmsInventoryRecordDto.setWarehouseName(dto.getWarehouseName()); |
|
|
|
wmsInventoryRecordDto.setWarehouseRackSid(dto.getWarehouseRackSid()); |
|
|
@ -547,6 +546,25 @@ public class WmsShelfBillService extends MybatisBaseService<WmsShelfBillMapper, |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public ResultBean shelvesSave(AppSaveBillRecordDto dto) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
String deptSid = ""; |
|
|
|
String createOrgSid = ""; |
|
|
|
String createByName = ""; |
|
|
|
SysUserVo userVo = sysUserFeign.fetchBySid(dto.getUserSid()).getData(); |
|
|
|
createByName = userVo.getName(); |
|
|
|
if (StringUtils.isNotBlank(dto.getOrgPath())) { |
|
|
|
String orgPath = dto.getOrgPath(); |
|
|
|
List<String> split = Arrays.asList(orgPath.split("/")); |
|
|
|
if (split.size() > 1) { |
|
|
|
//获取本级sid获取本级部门信息
|
|
|
|
SysOrganizationVo sysOrganization = sysOrganizationFeign.fetchBySid(split.get(split.size() - 2)).getData(); |
|
|
|
SysOrganizationVo sysOrganization1 = sysOrganizationFeign.fetchBySid(split.get(split.size() - 1)).getData(); |
|
|
|
deptSid = sysOrganization1.getSid(); |
|
|
|
} else { |
|
|
|
SysOrganizationVo sysOrganization = sysOrganizationFeign.fetchBySid(split.get(0)).getData(); |
|
|
|
deptSid = sysOrganization.getSid(); |
|
|
|
} |
|
|
|
createOrgSid = sysStaffOrgFeign.getOrgSidByPath(orgPath).getData(); |
|
|
|
} |
|
|
|
String shelvesId = dto.getShelvesSid(); |
|
|
|
WmsShelfBill wmsShelfBill = fetchBySid(shelvesId); |
|
|
|
String sourceBillSid = wmsShelfBill.getSourceBillSid(); |
|
|
@ -594,6 +612,39 @@ public class WmsShelfBillService extends MybatisBaseService<WmsShelfBillMapper, |
|
|
|
wmsGoodsTag.setState(1); |
|
|
|
wmsGoodsTagService.updateById(wmsGoodsTag); |
|
|
|
} |
|
|
|
WmsInventoryRecordDto recordDto = new WmsInventoryRecordDto(); |
|
|
|
recordDto.setCreateBySid(dto.getUserSid()); |
|
|
|
recordDto.setUseOrgSid(deptSid); |
|
|
|
recordDto.setCreateOrgSid(createOrgSid); |
|
|
|
recordDto.setHandlerSid(dto.getUserSid()); |
|
|
|
recordDto.setHandlerName(createByName); |
|
|
|
recordDto.setGoodsID(goodsID); |
|
|
|
recordDto.setSourceBillSid(shelvesId); |
|
|
|
recordDto.setBillNo(wmsShelfBill.getBillNo()); |
|
|
|
recordDto.setBillType("1"); |
|
|
|
recordDto.setBusTypeKey("01"); |
|
|
|
recordDto.setBusTypeValue("采购入库"); |
|
|
|
BeanUtil.copyProperties(wmsGoodsTag, recordDto, "sid", "createBySid"); |
|
|
|
WmsHouseInfoVo houseInfoVo = wmsWarehouseRackService.selHouseInfoByFullCode(houseCode).getData(); |
|
|
|
recordDto.setWarehouseSid(houseInfoVo.getWarehouseSid()); |
|
|
|
recordDto.setWarehouseName(houseInfoVo.getWarehouseName()); |
|
|
|
recordDto.setWarehouseRackSid(houseInfoVo.getWarehouseRackSid()); |
|
|
|
recordDto.setWarehouseRackCode(houseInfoVo.getWarehouseRackCode()); |
|
|
|
recordDto.setCount(count); |
|
|
|
recordDto.setCurrentCount(count); |
|
|
|
WmsReceiptBillDetail receiptBillDetail = wmsReceiptBillDetailService.selectByBillSidAndGoodsSkuCode(sourceBillSid, goodsSkuCode); |
|
|
|
if (null != receiptBillDetail) { |
|
|
|
if (null != receiptBillDetail.getCost()) { |
|
|
|
BigDecimal num = new BigDecimal(count); |
|
|
|
BigDecimal amount = num.multiply(receiptBillDetail.getCost()); |
|
|
|
recordDto.setCost(receiptBillDetail.getCost().toString()); |
|
|
|
recordDto.setAmount(amount.toString()); |
|
|
|
} |
|
|
|
if (null != receiptBillDetail.getTaxAmount()) { |
|
|
|
recordDto.setTax(receiptBillDetail.getTaxAmount().toString()); |
|
|
|
} |
|
|
|
} |
|
|
|
wmsInventoryRecordService.saveRecord(recordDto); |
|
|
|
} |
|
|
|
List<WmsShelfBillDetail> vos = wmsShelfBillDetailService.selectByMainSid(dto.getShelvesSid()); |
|
|
|
if (!vos.isEmpty()) { |
|
|
@ -635,4 +686,111 @@ public class WmsShelfBillService extends MybatisBaseService<WmsShelfBillMapper, |
|
|
|
} |
|
|
|
return rb.success(); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean<AppRecordVo> shelvesRecord(String sid) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
|
AppRecordVo vo = new AppRecordVo(); |
|
|
|
List<AppRecordListVo> records = new ArrayList<>();//上架记录
|
|
|
|
WmsShelfBill wmsShelfBill = fetchBySid(sid); |
|
|
|
if (null != wmsShelfBill) { |
|
|
|
vo.setShelvesId(wmsShelfBill.getBillNo()); |
|
|
|
vo.setReceivingId(wmsShelfBill.getSourceBillNo()); |
|
|
|
vo.setShelvesCreateTime(DateUtil.formatDate(wmsShelfBill.getCreateTime())); |
|
|
|
WmsReceiptBill wmsReceiptBill = wmsReceiptBillService.fetchBySid(wmsShelfBill.getSourceBillSid()); |
|
|
|
if (null != wmsReceiptBill) { |
|
|
|
vo.setReceivingUser(wmsReceiptBill.getCreateByName()); |
|
|
|
} |
|
|
|
vo.setShelvesState(wmsShelfBill.getBillStateValue()); |
|
|
|
List<WmsInventoryRecord> wmsInventoryRecords = wmsInventoryRecordService.selBySourceSid(sid); |
|
|
|
if (!wmsInventoryRecords.isEmpty()) { |
|
|
|
for (WmsInventoryRecord record : wmsInventoryRecords) { |
|
|
|
AppRecordListVo appRecordListVo = new AppRecordListVo(); |
|
|
|
appRecordListVo.setGoodsName(record.getGoodsSpuName()); |
|
|
|
WmsShelfBillDetail shelfBillDetail = wmsShelfBillDetailService.selByBillSidAndSkuCode(sid, record.getGoodsSkuCode()); |
|
|
|
if (null != shelfBillDetail) { |
|
|
|
BigDecimal count = new BigDecimal("0"); |
|
|
|
BigDecimal acCount = new BigDecimal("0"); |
|
|
|
if (null != shelfBillDetail.getCount()) { |
|
|
|
count = shelfBillDetail.getCount(); |
|
|
|
} |
|
|
|
if (null != shelfBillDetail.getActualCount()) { |
|
|
|
acCount = shelfBillDetail.getActualCount(); |
|
|
|
} |
|
|
|
String n = String.valueOf(count.intValue()); |
|
|
|
String c = String.valueOf(acCount.intValue()); |
|
|
|
appRecordListVo.setCount(n + "/" + c); |
|
|
|
} |
|
|
|
List<AppRecordListVo.AppRecordListDetailsDto> detailsList = new ArrayList<>(); |
|
|
|
List<WmsInventoryRecord> wmsInventoryRecordList = wmsInventoryRecordService.selBySourceSidAndSkuCode(sid, record.getGoodsSkuCode()); |
|
|
|
if (!wmsInventoryRecordList.isEmpty()) { |
|
|
|
for (WmsInventoryRecord inventoryRecord : wmsInventoryRecordList) { |
|
|
|
AppRecordListVo.AppRecordListDetailsDto detailsDto = new AppRecordListVo.AppRecordListDetailsDto(); |
|
|
|
detailsDto.setGoodsID(inventoryRecord.getGoodsID()); |
|
|
|
String houseName = ""; |
|
|
|
String rockCode = ""; |
|
|
|
if (StringUtils.isNotBlank(inventoryRecord.getWarehouseName())) { |
|
|
|
houseName = inventoryRecord.getWarehouseName(); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(inventoryRecord.getWarehouseRackCode())) { |
|
|
|
rockCode = inventoryRecord.getWarehouseRackCode(); |
|
|
|
} |
|
|
|
detailsDto.setHouseName(houseName + rockCode); |
|
|
|
detailsDto.setShows(inventoryRecord.getHandlerName() + "于" + sdf.format(inventoryRecord.getCreateTime()) + "上架" + inventoryRecord.getCount().intValue() + inventoryRecord.getUnit()); |
|
|
|
detailsList.add(detailsDto); |
|
|
|
} |
|
|
|
appRecordListVo.setDetailsList(detailsList); |
|
|
|
} |
|
|
|
records.add(appRecordListVo); |
|
|
|
} |
|
|
|
vo.setRecords(records); |
|
|
|
} |
|
|
|
} |
|
|
|
return rb.success().setData(vo); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean<AppDetailsVo> shelvesDetails(String sid) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
AppDetailsVo vo = new AppDetailsVo(); |
|
|
|
List<AppDetailsVo.AppDetailsListVo> goodsList = new ArrayList<>(); |
|
|
|
WmsShelfBill wmsShelfBill = fetchBySid(sid); |
|
|
|
if (null != wmsShelfBill) { |
|
|
|
vo.setShelvesId(wmsShelfBill.getBillNo()); |
|
|
|
vo.setReceivingId(wmsShelfBill.getSourceBillNo()); |
|
|
|
vo.setShelvesCreateTime(DateUtil.formatDate(wmsShelfBill.getCreateTime())); |
|
|
|
WmsReceiptBill wmsReceiptBill = wmsReceiptBillService.fetchBySid(wmsShelfBill.getSourceBillSid()); |
|
|
|
if (null != wmsReceiptBill) { |
|
|
|
vo.setReceivingUser(wmsReceiptBill.getCreateByName()); |
|
|
|
} |
|
|
|
vo.setShelvesState(wmsShelfBill.getBillStateValue()); |
|
|
|
if (StringUtils.isNotBlank(wmsShelfBill.getRemarks())) { |
|
|
|
vo.setRemarks(wmsShelfBill.getRemarks()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(wmsShelfBill.getUpShelfName())) { |
|
|
|
vo.setShelvesUsers(wmsShelfBill.getUpShelfName()); |
|
|
|
} |
|
|
|
List<WmsShelfBillDetail> details = wmsShelfBillDetailService.selectByMainSid(sid); |
|
|
|
if (!details.isEmpty()) { |
|
|
|
for (WmsShelfBillDetail detail : details) { |
|
|
|
AppDetailsVo.AppDetailsListVo dVo = new AppDetailsVo.AppDetailsListVo(); |
|
|
|
BeanUtil.copyProperties(detail, dVo); |
|
|
|
dVo.setGoodsName(detail.getGoodsSpuName()); |
|
|
|
BigDecimal count = new BigDecimal("0"); |
|
|
|
BigDecimal acCount = new BigDecimal("0"); |
|
|
|
if (null != detail.getCount()) { |
|
|
|
count = detail.getCount(); |
|
|
|
} |
|
|
|
if (null != detail.getActualCount()) { |
|
|
|
acCount = detail.getActualCount(); |
|
|
|
} |
|
|
|
String n = String.valueOf(count.subtract(acCount).intValue()); |
|
|
|
String c = String.valueOf(acCount.intValue()); |
|
|
|
dVo.setActualNoCount(c + "/" + n); |
|
|
|
goodsList.add(dVo); |
|
|
|
} |
|
|
|
vo.setGoodsList(goodsList); |
|
|
|
} |
|
|
|
} |
|
|
|
return rb.success().setData(vo); |
|
|
|
} |
|
|
|
} |
|
|
|