|
|
@ -1,20 +1,22 @@
|
|
|
|
package com.op.wms.service.impl;
|
|
|
|
package com.op.wms.service.impl;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
|
|
|
|
|
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
|
|
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
|
|
|
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
|
|
|
|
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
|
|
|
|
|
|
|
|
import com.op.common.core.domain.R;
|
|
|
|
import com.op.common.core.utils.DateUtils;
|
|
|
|
import com.op.common.core.utils.DateUtils;
|
|
|
|
import com.op.wms.domain.WmsProductPutTray;
|
|
|
|
import com.op.common.core.utils.uuid.IdUtils;
|
|
|
|
import com.op.wms.domain.WmsProductPutTrayCode;
|
|
|
|
import com.op.system.api.RemoteSapService;
|
|
|
|
import com.op.wms.mapper.WmsProductPutTrayMapper;
|
|
|
|
import com.op.wms.domain.*;
|
|
|
|
|
|
|
|
import com.op.wms.mapper.*;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
|
|
import org.springframework.data.redis.core.ValueOperations;
|
|
|
|
import org.springframework.data.redis.core.ValueOperations;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import com.op.wms.mapper.WmsProductPutMapper;
|
|
|
|
|
|
|
|
import com.op.wms.domain.WmsProductPut;
|
|
|
|
|
|
|
|
import com.op.wms.service.IWmsProductPutService;
|
|
|
|
import com.op.wms.service.IWmsProductPutService;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -29,7 +31,14 @@ public class WmsProductPutServiceImpl implements IWmsProductPutService {
|
|
|
|
private WmsProductPutMapper wmsProductPutMapper;
|
|
|
|
private WmsProductPutMapper wmsProductPutMapper;
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private RedisTemplate<String,String> redisTemplate;
|
|
|
|
private RedisTemplate<String,String> redisTemplate;
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private WmsProductPutRecordsMapper wmsProductPutRecordsMapper;
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private WmsFpStorageNewsSnMapper wmsFpStorageNewsSnMapper;
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private WmsFpStorageNewsMapper wmsFpStorageNewsMapper;
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private RemoteSapService remoteSapService;
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 查询成品生产入库
|
|
|
|
* 查询成品生产入库
|
|
|
|
*
|
|
|
|
*
|
|
|
@ -131,4 +140,135 @@ public class WmsProductPutServiceImpl implements IWmsProductPutService {
|
|
|
|
WmsProductPut wmsProductPut1= wmsProductPutMapper.selectMesReportWork(wmsProductPut);
|
|
|
|
WmsProductPut wmsProductPut1= wmsProductPutMapper.selectMesReportWork(wmsProductPut);
|
|
|
|
return wmsProductPut1;
|
|
|
|
return wmsProductPut1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 入库--wms_product_put_records入库记录表(记录每次入库的单子和入库数量)
|
|
|
|
|
|
|
|
* ,wms_fp_storage_news_sn明细表(入库明细-托盘,库位),
|
|
|
|
|
|
|
|
* wms_fp_storage_news(物料)库存主表
|
|
|
|
|
|
|
|
* ,wms_product_put(记录单子)入库单
|
|
|
|
|
|
|
|
*其中他这个要生成批次,
|
|
|
|
|
|
|
|
* @param wmsProductPut
|
|
|
|
|
|
|
|
* @return
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public String WmsProductPutByWorkOrderConfirm(WmsProductPut wmsProductPut) {
|
|
|
|
|
|
|
|
DynamicDataSourceContextHolder.push("ds_" +wmsProductPut.getFactoryCode());
|
|
|
|
|
|
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
|
|
|
|
|
|
|
|
Date date = new Date();
|
|
|
|
|
|
|
|
String formattedDate = dateFormat.format(date);//批次
|
|
|
|
|
|
|
|
List<WmsProductPut> wmsProductPutList= wmsProductPut.getWmsProductPut();
|
|
|
|
|
|
|
|
WmsProductPut wmsProductPutk=new WmsProductPut();
|
|
|
|
|
|
|
|
//wms_product_put
|
|
|
|
|
|
|
|
wmsProductPutk.setId(IdUtils.fastSimpleUUID());
|
|
|
|
|
|
|
|
wmsProductPutk.setWorkOrder(wmsProductPut.getWorkOrder());
|
|
|
|
|
|
|
|
wmsProductPutk.setFactoryCode(wmsProductPut.getFactoryCode());
|
|
|
|
|
|
|
|
wmsProductPutk.setWhCode(wmsProductPut.getWhCode());//仓库编码
|
|
|
|
|
|
|
|
wmsProductPutk.setProductName(wmsProductPut.getProductName());
|
|
|
|
|
|
|
|
wmsProductPutk.setProductCode(wmsProductPut.getProductCode());
|
|
|
|
|
|
|
|
wmsProductPutk.setProductOrder(wmsProductPut.getProductOrder());
|
|
|
|
|
|
|
|
wmsProductPutk.setPlanQuantity(wmsProductPut.getPlanQuantity());
|
|
|
|
|
|
|
|
wmsProductPutk.setPutQuantity(wmsProductPut.getPutQuantity());
|
|
|
|
|
|
|
|
wmsProductPutk.setStatus("1");
|
|
|
|
|
|
|
|
wmsProductPutk.setSapStatus("0");
|
|
|
|
|
|
|
|
wmsProductPutk.setBatchNumber(wmsProductPut.getBatchNumber());//
|
|
|
|
|
|
|
|
wmsProductPutk.setAttr3(formattedDate);//
|
|
|
|
|
|
|
|
wmsProductPutk.setCreateBy(wmsProductPut.getCreateBy());
|
|
|
|
|
|
|
|
wmsProductPutk.setCreateTime(new Date());
|
|
|
|
|
|
|
|
wmsProductPutk.setUnitOfMeasure(wmsProductPut.getUnitOfMeasure());
|
|
|
|
|
|
|
|
wmsProductPutMapper.insertWmsProductPut(wmsProductPutk);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String SUCCESS="操作成功";
|
|
|
|
|
|
|
|
for (WmsProductPut wmsProductPut1:
|
|
|
|
|
|
|
|
wmsProductPutList) {
|
|
|
|
|
|
|
|
WmsProductPutRecords wmsProductPutRecords=new WmsProductPutRecords();
|
|
|
|
|
|
|
|
wmsProductPutRecords.setWorkOrder(wmsProductPut.getWorkOrder());
|
|
|
|
|
|
|
|
wmsProductPutRecords.setProductOrder(wmsProductPut.getProductOrder());
|
|
|
|
|
|
|
|
wmsProductPutRecords.setProductName(wmsProductPut.getProductName());
|
|
|
|
|
|
|
|
wmsProductPutRecords.setProductCode(wmsProductPut.getProductCode());
|
|
|
|
|
|
|
|
wmsProductPutRecords.setWhCode(wmsProductPut.getWhCode());//仓库编码
|
|
|
|
|
|
|
|
wmsProductPutRecords.setId(IdUtils.fastSimpleUUID());
|
|
|
|
|
|
|
|
wmsProductPutRecords.setWlCode(wmsProductPut1.getWlCode());
|
|
|
|
|
|
|
|
wmsProductPutRecords.setSn(wmsProductPut1.getSn());
|
|
|
|
|
|
|
|
wmsProductPutRecords.setNumber(wmsProductPut1.getNumber());
|
|
|
|
|
|
|
|
wmsProductPutRecords.setCreateBy(wmsProductPut.getCreateBy());
|
|
|
|
|
|
|
|
wmsProductPutRecords.setCreateTime(new Date());
|
|
|
|
|
|
|
|
wmsProductPutRecordsMapper.insertWmsProductPutRecords(wmsProductPutRecords);
|
|
|
|
|
|
|
|
//wms_fp_storage_news_sn
|
|
|
|
|
|
|
|
WmsFpStorageNewsSn wmsFpStorageNewsSn=new WmsFpStorageNewsSn();
|
|
|
|
|
|
|
|
wmsFpStorageNewsSn.setStorageId(IdUtils.fastSimpleUUID());
|
|
|
|
|
|
|
|
wmsFpStorageNewsSn.setFactoryCode(wmsProductPut.getFactoryCode());
|
|
|
|
|
|
|
|
wmsFpStorageNewsSn.setWhCode(wmsProductPut.getWhCode());//仓库编码
|
|
|
|
|
|
|
|
wmsFpStorageNewsSn.setWlCode(wmsProductPut1.getWlCode());
|
|
|
|
|
|
|
|
wmsFpStorageNewsSn.setOrderNo(wmsProductPutk.getId());
|
|
|
|
|
|
|
|
wmsFpStorageNewsSn.setProductCode(wmsProductPut.getProductCode());
|
|
|
|
|
|
|
|
wmsFpStorageNewsSn.setProductName(wmsProductPut.getProductName());
|
|
|
|
|
|
|
|
wmsFpStorageNewsSn.setSn(wmsProductPut1.getSn());
|
|
|
|
|
|
|
|
wmsFpStorageNewsSn.setAmount(new BigDecimal(wmsProductPut1.getNumber()));
|
|
|
|
|
|
|
|
wmsFpStorageNewsSn.setBatchNumber(wmsProductPut.getBatchNumber());
|
|
|
|
|
|
|
|
wmsFpStorageNewsSn.setUserDefined2(formattedDate);
|
|
|
|
|
|
|
|
wmsFpStorageNewsSn.setCreateBy(wmsProductPut.getCreateBy());
|
|
|
|
|
|
|
|
wmsFpStorageNewsSn.setCreateTime(new Date());
|
|
|
|
|
|
|
|
wmsFpStorageNewsSn.setActiveFlag("1");
|
|
|
|
|
|
|
|
wmsFpStorageNewsSnMapper.insertWmsFpStorageNewsSn(wmsFpStorageNewsSn);
|
|
|
|
|
|
|
|
// wms_fp_storage_news
|
|
|
|
|
|
|
|
WmsFpStorageNews wmsFpStorageNews=new WmsFpStorageNews();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wmsFpStorageNews.setWhCode(wmsProductPut.getWhCode());//仓库编码
|
|
|
|
|
|
|
|
wmsFpStorageNews.setWlCode(wmsProductPut1.getWlCode());
|
|
|
|
|
|
|
|
wmsFpStorageNews.setStorageType("成品");
|
|
|
|
|
|
|
|
wmsFpStorageNews.setProductCode(wmsProductPut.getProductCode());
|
|
|
|
|
|
|
|
wmsFpStorageNews.setProductName(wmsProductPut.getProductName());
|
|
|
|
|
|
|
|
wmsFpStorageNews.setFactoryCode(wmsProductPut.getFactoryCode());
|
|
|
|
|
|
|
|
wmsFpStorageNews.setActiveFlag("1");
|
|
|
|
|
|
|
|
wmsFpStorageNews.setUserDefined1(wmsProductPut.getUnitOfMeasure());
|
|
|
|
|
|
|
|
List<WmsFpStorageNews> wmsFpStorageNewsList= wmsFpStorageNewsMapper.selectWmsFpStorageNewsList(wmsFpStorageNews);
|
|
|
|
|
|
|
|
wmsFpStorageNews.setStorageId(IdUtils.fastSimpleUUID());
|
|
|
|
|
|
|
|
wmsFpStorageNews.setAmount(new BigDecimal(wmsProductPut1.getNumber()));
|
|
|
|
|
|
|
|
wmsFpStorageNews.setCreateBy(wmsProductPut.getCreateBy());
|
|
|
|
|
|
|
|
wmsFpStorageNews.setCreateTime(new Date());
|
|
|
|
|
|
|
|
if (wmsFpStorageNewsList.size()>0){
|
|
|
|
|
|
|
|
WmsFpStorageNews wmsFpStorageNews1= wmsFpStorageNewsList.get(0);
|
|
|
|
|
|
|
|
BigDecimal amount= wmsFpStorageNews1.getAmount();
|
|
|
|
|
|
|
|
BigDecimal amountAdd= amount.add(wmsFpStorageNews.getAmount());
|
|
|
|
|
|
|
|
wmsFpStorageNews1.setAmount(amountAdd);
|
|
|
|
|
|
|
|
wmsFpStorageNewsMapper.updateWmsFpStorageNews(wmsFpStorageNews1);
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
wmsFpStorageNewsMapper.insertWmsFpStorageNews(wmsFpStorageNews);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return SUCCESS;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
@DS("#header.poolName")
|
|
|
|
|
|
|
|
public String WmsProductPutByWorkOrderConfirmSAPPosting(List<WmsProductPut> wmsProductPut) {
|
|
|
|
|
|
|
|
String msgs="操作完成";
|
|
|
|
|
|
|
|
for (WmsProductPut wmsProductPut1:
|
|
|
|
|
|
|
|
wmsProductPut) {
|
|
|
|
|
|
|
|
WmsProductPut wmsProductPut2= wmsProductPutMapper.selectWmsProductPutSAPById(wmsProductPut1.getId());
|
|
|
|
|
|
|
|
List<Map<String, Object>> mapList = new ArrayList<>();
|
|
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
|
|
|
map.put("AUFNR",wmsProductPut2.getProductOrder());
|
|
|
|
|
|
|
|
map.put("WERKS",wmsProductPut2.getFactoryCode());
|
|
|
|
|
|
|
|
map.put("LGORT",wmsProductPut2.getWhCode());
|
|
|
|
|
|
|
|
map.put("QUANTITY",wmsProductPut2.getPutQuantity());
|
|
|
|
|
|
|
|
map.put("ERFME",wmsProductPut2.getUnitOfMeasure());
|
|
|
|
|
|
|
|
map.put("BATCH",wmsProductPut2.getAttr3());
|
|
|
|
|
|
|
|
map.put("HSDAT",wmsProductPut2.getProductDate());
|
|
|
|
|
|
|
|
mapList.add(map);
|
|
|
|
|
|
|
|
R result= remoteSapService.sapOrderReceipt(mapList);
|
|
|
|
|
|
|
|
int code= result.getCode();
|
|
|
|
|
|
|
|
String msg= result.getMsg();
|
|
|
|
|
|
|
|
wmsProductPut2.setSapMessage(msg);
|
|
|
|
|
|
|
|
if (code==200) {//过账成功
|
|
|
|
|
|
|
|
String date= (String) result.getData();
|
|
|
|
|
|
|
|
wmsProductPut2.setSapProof(date);
|
|
|
|
|
|
|
|
wmsProductPut2.setSapStatus("1");
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
wmsProductPut2.setSapStatus("2");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
wmsProductPutMapper.updateWmsProductPut(wmsProductPut2);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return msgs;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|