|
|
@ -10,10 +10,17 @@ 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.wmswarehousearea.WmsWarehouseArea; |
|
|
|
import com.yxt.wms.biz.base.wmswarehousearea.WmsWarehouseAreaService; |
|
|
|
import com.yxt.wms.biz.base.wmswarehouseinfo.WmsWarehouseInfo; |
|
|
|
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.wmsgoodstag.WmsGoodsTag; |
|
|
|
import com.yxt.wms.biz.inventory.wmsgoodstag.WmsGoodsTagService; |
|
|
|
import com.yxt.wms.biz.inventory.wmsgoodstag.app.*; |
|
|
|
import com.yxt.wms.biz.inventory.wmsgoodstag.util.GetSerialNum; |
|
|
|
import com.yxt.wms.biz.inventory.wmsinventory.WmsInventorySaveDto; |
|
|
|
import com.yxt.wms.biz.inventory.wmsinventory.WmsInventoryService; |
|
|
|
import com.yxt.wms.biz.inventory.wmsinventoryrecord.WmsInventoryRecord; |
|
|
@ -26,6 +33,7 @@ import com.yxt.wms.biz.inventory.wmsreceiptbilldetail.WmsReceiptBillDetailServic |
|
|
|
import com.yxt.wms.biz.inventory.wmsreceiptbilldetailbatch.WmsReceiptBillDetailBatchService; |
|
|
|
import com.yxt.wms.biz.inventory.wmsshelfbill.app.*; |
|
|
|
import com.yxt.wms.biz.inventory.wmsshelfbilldetail.*; |
|
|
|
import com.yxt.wms.feign.base.basegoodspu.BaseGoodsSpuFeign; |
|
|
|
import com.yxt.wms.feign.base.basegoodssku.BaseGoodsSkuDetailsVo; |
|
|
|
import com.yxt.wms.feign.base.basegoodssku.BaseGoodsSkuFeign; |
|
|
|
import com.yxt.wms.feign.portal.privilege.PrivilegeQuery; |
|
|
@ -46,6 +54,7 @@ import javax.annotation.Resource; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.util.*; |
|
|
|
import java.util.concurrent.locks.ReentrantLock; |
|
|
|
|
|
|
|
/** |
|
|
|
* @description: |
|
|
@ -54,6 +63,8 @@ import java.util.*; |
|
|
|
**/ |
|
|
|
@Service |
|
|
|
public class WmsShelfBillService extends MybatisBaseService<WmsShelfBillMapper, WmsShelfBill> { |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
private WmsShelfBillDetailService wmsShelfBillDetailService; |
|
|
|
@Autowired |
|
|
@ -81,7 +92,14 @@ public class WmsShelfBillService extends MybatisBaseService<WmsShelfBillMapper, |
|
|
|
@Autowired |
|
|
|
private WmsWarehouseRackService wmsWarehouseRackService; |
|
|
|
@Autowired |
|
|
|
private WmsWarehouseInfoService wmsWarehouseInfoService; |
|
|
|
@Autowired |
|
|
|
private WmsWarehouseAreaService wmsWarehouseAreaService; |
|
|
|
@Autowired |
|
|
|
private WmsGoodsTagService wmsGoodsTagService; |
|
|
|
@Autowired |
|
|
|
private BaseGoodsSpuFeign baseGoodsSpuFeign; |
|
|
|
|
|
|
|
|
|
|
|
public PagerVo<WmsShelfBillVo> listPage(PagerQuery<WmsShelfBillQuery> pq) { |
|
|
|
WmsShelfBillQuery query = pq.getParams(); |
|
|
@ -796,4 +814,261 @@ public class WmsShelfBillService extends MybatisBaseService<WmsShelfBillMapper, |
|
|
|
} |
|
|
|
return rb.success().setData(vo); |
|
|
|
} |
|
|
|
|
|
|
|
//----------------------------标签打印-------------------------
|
|
|
|
public ResultBean<GoodsTagVo> print0(TagQuery query) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
GoodsTagVo vo = new GoodsTagVo(); |
|
|
|
List<String> sids = query.getSids(); |
|
|
|
List<GoodsTag> list = new ArrayList<>(); |
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyMMdd"); |
|
|
|
String format = sdf.format(new Date()); |
|
|
|
Set<String> idSet = new HashSet<>(); |
|
|
|
for (String sid : sids) { |
|
|
|
WmsReceiptBillDetail receiptBillDetail = wmsReceiptBillDetailService.fetchBySid(sid); |
|
|
|
String billSid = receiptBillDetail.getBillSid(); |
|
|
|
String goodSpuSid = receiptBillDetail.getGoodSpuSid(); |
|
|
|
List<WmsGoodsTag> wmsGoodsTags = wmsGoodsTagService.selByBillSidAndBillDetailsSidAndGoodsSpuSid(billSid, sid, goodSpuSid); |
|
|
|
String goodsSkuCode = receiptBillDetail.getGoodsSkuCode(); |
|
|
|
String rule = goodsSkuCode + format; |
|
|
|
if (!wmsGoodsTags.isEmpty() && wmsGoodsTags.size() > 0) { |
|
|
|
for (WmsGoodsTag wmsGoodsTag : wmsGoodsTags) { |
|
|
|
GoodsTag goodsTag = new GoodsTag(); |
|
|
|
goodsTag.setSid(sid); |
|
|
|
goodsTag.setQrText(wmsGoodsTag.getGoodsID()); |
|
|
|
if (StringUtils.isNotBlank(wmsGoodsTag.getGoodsSpuName())) { |
|
|
|
goodsTag.setText1(wmsGoodsTag.getGoodsSpuName()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(wmsGoodsTag.getGoodsSkuCode())) { |
|
|
|
goodsTag.setText2(wmsGoodsTag.getGoodsSkuCode()); |
|
|
|
} |
|
|
|
goodsTag.setText3(DateUtil.formatDate(wmsGoodsTag.getCreateTime())); |
|
|
|
list.add(goodsTag); |
|
|
|
} |
|
|
|
} else { |
|
|
|
//查询该商品是否为一物一码
|
|
|
|
String isGoodsID = baseGoodsSpuFeign.selIsGoodsID(goodSpuSid).getData(); |
|
|
|
BigDecimal actualInCount = receiptBillDetail.getActualInCount(); |
|
|
|
int actualInCountInt = actualInCount.intValue(); |
|
|
|
if (actualInCountInt > 1) { |
|
|
|
if (isGoodsID.equals("0")) { |
|
|
|
//不是一物一码
|
|
|
|
//查询流水号生成goodsID
|
|
|
|
String i = wmsGoodsTagService.selectGoodsIDNum(goodsSkuCode + format); |
|
|
|
if (StringUtils.isBlank(i)) { |
|
|
|
i = "0"; |
|
|
|
} |
|
|
|
int intValue = Integer.valueOf(i).intValue(); |
|
|
|
String goodsID = GetSerialNum.getNum(intValue, goodsSkuCode); |
|
|
|
if (idSet.contains(goodsID)) { |
|
|
|
List<Integer> idList = new ArrayList<>(); |
|
|
|
for (String s : idSet) { |
|
|
|
if (s.contains(rule)) { |
|
|
|
Integer integer = new Integer(s.substring(rule.length())); |
|
|
|
idList.add(integer); |
|
|
|
} |
|
|
|
} |
|
|
|
int max = Collections.max(idList); |
|
|
|
String num = String.format("%04d", max + 1); |
|
|
|
goodsID = rule + num; |
|
|
|
} |
|
|
|
GoodsTag goodsTag = new GoodsTag(); |
|
|
|
goodsTag.setSid(sid); |
|
|
|
goodsTag.setQrText(goodsID); |
|
|
|
if (StringUtils.isNotBlank(receiptBillDetail.getGoodsSpuName())) { |
|
|
|
goodsTag.setText1(receiptBillDetail.getGoodsSpuName()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(receiptBillDetail.getGoodsSkuCode())) { |
|
|
|
goodsTag.setText2(receiptBillDetail.getGoodsSkuCode()); |
|
|
|
} |
|
|
|
goodsTag.setText3(DateUtil.formatDate(new Date())); |
|
|
|
idSet.add(goodsID); |
|
|
|
list.add(goodsTag); |
|
|
|
} else { |
|
|
|
//是一物一码
|
|
|
|
for (int i = 0; i < actualInCountInt; i++) { |
|
|
|
String j = wmsGoodsTagService.selectGoodsIDNum(goodsSkuCode + format); |
|
|
|
if (StringUtils.isBlank(j)) { |
|
|
|
j = "0"; |
|
|
|
} |
|
|
|
int intValue = Integer.valueOf(j).intValue(); |
|
|
|
String goodsID = GetSerialNum.getNum(intValue, goodsSkuCode); |
|
|
|
if (idSet.contains(goodsID)) { |
|
|
|
List<Integer> idList = new ArrayList<>(); |
|
|
|
for (String s : idSet) { |
|
|
|
if (s.contains(rule)) { |
|
|
|
Integer integer = new Integer(s.substring(rule.length())); |
|
|
|
idList.add(integer); |
|
|
|
} |
|
|
|
} |
|
|
|
int max = Collections.max(idList); |
|
|
|
String num = String.format("%04d", max + 1); |
|
|
|
goodsID = rule + num; |
|
|
|
} |
|
|
|
GoodsTag goodsTag = new GoodsTag(); |
|
|
|
goodsTag.setSid(sid); |
|
|
|
goodsTag.setQrText(goodsID); |
|
|
|
if (StringUtils.isNotBlank(receiptBillDetail.getGoodsSpuName())) { |
|
|
|
goodsTag.setText1(receiptBillDetail.getGoodsSpuName()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(receiptBillDetail.getGoodsSkuCode())) { |
|
|
|
goodsTag.setText2(receiptBillDetail.getGoodsSkuCode()); |
|
|
|
} |
|
|
|
goodsTag.setText3(DateUtil.formatDate(new Date())); |
|
|
|
idSet.add(goodsID); |
|
|
|
list.add(goodsTag); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
//查询流水号生成goodsID
|
|
|
|
String i = wmsGoodsTagService.selectGoodsIDNum(goodsSkuCode + format); |
|
|
|
if (StringUtils.isBlank(i)) { |
|
|
|
i = "0"; |
|
|
|
} |
|
|
|
int intValue = Integer.valueOf(i).intValue(); |
|
|
|
String goodsID = GetSerialNum.getNum(intValue, goodsSkuCode); |
|
|
|
if (idSet.contains(goodsID)) { |
|
|
|
List<Integer> idList = new ArrayList<>(); |
|
|
|
for (String s : idSet) { |
|
|
|
if (s.contains(rule)) { |
|
|
|
Integer integer = new Integer(s.substring(rule.length())); |
|
|
|
idList.add(integer); |
|
|
|
} |
|
|
|
} |
|
|
|
int max = Collections.max(idList); |
|
|
|
String num = String.format("%04d", max + 1); |
|
|
|
goodsID = rule + num; |
|
|
|
} |
|
|
|
GoodsTag goodsTag = new GoodsTag(); |
|
|
|
goodsTag.setSid(sid); |
|
|
|
goodsTag.setQrText(goodsID); |
|
|
|
if (StringUtils.isNotBlank(receiptBillDetail.getGoodsSpuName())) { |
|
|
|
goodsTag.setText1(receiptBillDetail.getGoodsSpuName()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(receiptBillDetail.getGoodsSkuCode())) { |
|
|
|
goodsTag.setText2(receiptBillDetail.getGoodsSkuCode()); |
|
|
|
} |
|
|
|
goodsTag.setText3(DateUtil.formatDate(new Date())); |
|
|
|
idSet.add(goodsID); |
|
|
|
list.add(goodsTag); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
vo.setGoods(list); |
|
|
|
return rb.success().setData(vo); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean printCount(PrintQuery query) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
String type = query.getType(); |
|
|
|
List<GoodsTag> tags = query.getSids(); |
|
|
|
String billSid = ""; |
|
|
|
Set<String> sids = new HashSet<>(); |
|
|
|
if (type.equals("0")) { |
|
|
|
//商品
|
|
|
|
for (GoodsTag tag : tags) { |
|
|
|
String sid = tag.getSid(); |
|
|
|
WmsReceiptBillDetail receiptBillDetail = wmsReceiptBillDetailService.fetchBySid(sid); |
|
|
|
if (null != receiptBillDetail) { |
|
|
|
billSid = receiptBillDetail.getBillSid(); |
|
|
|
sids.add(sid); |
|
|
|
WmsReceiptBill wmsReceiptBill = wmsReceiptBillService.fetchBySid(billSid); |
|
|
|
WmsGoodsTag goodsTag = wmsGoodsTagService.selByBillSidAndGoodsID(billSid, tag.getQrText()); |
|
|
|
if (null == goodsTag) { |
|
|
|
//新增标签
|
|
|
|
WmsGoodsTag wmsGoodsTag = new WmsGoodsTag(); |
|
|
|
BeanUtil.copyProperties(receiptBillDetail, wmsGoodsTag, "id", "sid", "createTime", "modifyTime", "remarks"); |
|
|
|
wmsGoodsTag.setGoodsID(tag.getQrText()); |
|
|
|
wmsGoodsTag.setBillDetailSid(sid); |
|
|
|
wmsGoodsTag.setCreateBySid(wmsReceiptBill.getCreateBySid()); |
|
|
|
BigDecimal actualInCount = receiptBillDetail.getActualInCount(); |
|
|
|
int actualInCountInt = actualInCount.intValue(); |
|
|
|
if (actualInCountInt > 1) { |
|
|
|
//查询该商品是否为一物一码
|
|
|
|
String isGoodsID = baseGoodsSpuFeign.selIsGoodsID(receiptBillDetail.getGoodSpuSid()).getData(); |
|
|
|
if (isGoodsID.equals("0")) { |
|
|
|
wmsGoodsTag.setGoodsCount(receiptBillDetail.getActualInCount()); |
|
|
|
} else { |
|
|
|
wmsGoodsTag.setGoodsCount(new BigDecimal("1")); |
|
|
|
} |
|
|
|
} else { |
|
|
|
wmsGoodsTag.setGoodsCount(new BigDecimal("1")); |
|
|
|
} |
|
|
|
wmsGoodsTagService.insert(wmsGoodsTag); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (sids.size() > 0) { |
|
|
|
for (String sid : sids) { |
|
|
|
WmsReceiptBillDetail receiptBillDetail = wmsReceiptBillDetailService.fetchBySid(sid); |
|
|
|
Integer printCount = receiptBillDetail.getPrintCount(); |
|
|
|
receiptBillDetail.setPrintCount(printCount + 1); |
|
|
|
wmsReceiptBillDetailService.updateById(receiptBillDetail); |
|
|
|
} |
|
|
|
} |
|
|
|
List<WmsReceiptBillDetail> details = wmsReceiptBillDetailService.selByBillSid(billSid); |
|
|
|
HashSet<Integer> set = new HashSet<>(); |
|
|
|
if (!details.isEmpty()) { |
|
|
|
for (WmsReceiptBillDetail detail : details) { |
|
|
|
set.add(detail.getPrintCount()); |
|
|
|
} |
|
|
|
} |
|
|
|
if (!set.contains(0)) { |
|
|
|
WmsReceiptBill wmsReceiptBill = wmsReceiptBillService.fetchBySid(billSid); |
|
|
|
wmsReceiptBill.setPrintState(1); |
|
|
|
wmsReceiptBillService.updateById(wmsReceiptBill); |
|
|
|
} |
|
|
|
} else if (type.equals("1")) { |
|
|
|
//库位
|
|
|
|
for (GoodsTag tag : tags) { |
|
|
|
String sid = tag.getSid(); |
|
|
|
WmsWarehouseRack rack = wmsWarehouseRackService.fetchBySid(sid); |
|
|
|
if (null != rack) { |
|
|
|
Integer printCount = rack.getPrintCount(); |
|
|
|
rack.setPrintCount(printCount + 1); |
|
|
|
wmsWarehouseRackService.updateById(rack); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return rb.success(); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean<HousePrintVo> print1(TagQuery query) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
HousePrintVo vo = new HousePrintVo(); |
|
|
|
List<HouseRackPrint> houses = new ArrayList<>(); |
|
|
|
List<String> sids = query.getSids(); |
|
|
|
for (String sid : sids) { |
|
|
|
HouseRackPrint print = new HouseRackPrint(); |
|
|
|
print.setSid(sid); |
|
|
|
WmsWarehouseRack rack = wmsWarehouseRackService.fetchBySid(sid); |
|
|
|
if (null != rack) { |
|
|
|
String warehouseSid = rack.getWarehouseSid(); |
|
|
|
String locationSid = rack.getLocationSid(); |
|
|
|
WmsWarehouseInfo warehouseInfo = wmsWarehouseInfoService.fetchBySid(warehouseSid); |
|
|
|
if (null != warehouseInfo) { |
|
|
|
print.setText00(warehouseInfo.getWarehouseName()); |
|
|
|
} |
|
|
|
WmsWarehouseArea wmsWarehouseArea = wmsWarehouseAreaService.fetchBySid(locationSid); |
|
|
|
if (null != wmsWarehouseArea) { |
|
|
|
print.setText0(wmsWarehouseArea.getAreaName()); |
|
|
|
} |
|
|
|
String[] split = rack.getRackCode().split("-"); |
|
|
|
if (split.length >= 4) { |
|
|
|
String p = split[0]; |
|
|
|
String j = split[1]; |
|
|
|
String c = split[2]; |
|
|
|
String w = split[3]; |
|
|
|
print.setText5(p); |
|
|
|
print.setText6(j); |
|
|
|
print.setText7(c); |
|
|
|
print.setText8(w); |
|
|
|
} |
|
|
|
print.setQrText(sid + "#"); |
|
|
|
houses.add(print); |
|
|
|
} |
|
|
|
} |
|
|
|
vo.setHouses(houses); |
|
|
|
return rb.success().setData(vo); |
|
|
|
} |
|
|
|
} |
|
|
|