|
|
|
@ -8,6 +8,7 @@ import java.util.Random;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.nacos.common.utils.UuidUtils;
|
|
|
|
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
|
|
|
|
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
|
|
|
|
|
import com.op.common.core.context.SecurityContextHolder;
|
|
|
|
|
import com.op.common.core.exception.ServiceException;
|
|
|
|
|
import com.op.common.core.utils.uuid.IdUtils;
|
|
|
|
@ -62,8 +63,10 @@ public class WmsProductPutTrayServiceImpl implements IWmsProductPutTrayService {
|
|
|
|
|
* @return 成品生产入库关联托盘
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
@DS("#header.poolName")
|
|
|
|
|
// @DS("#header.poolName")
|
|
|
|
|
public List<WmsProductPutTray> selectWmsProductPutTrayList(WmsProductPutTray wmsProductPutTray) {
|
|
|
|
|
//todo 需要修改
|
|
|
|
|
DynamicDataSourceContextHolder.push("ds_1000");
|
|
|
|
|
return wmsProductPutTrayMapper.selectWmsProductPutTrayList(wmsProductPutTray);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -74,21 +77,26 @@ public class WmsProductPutTrayServiceImpl implements IWmsProductPutTrayService {
|
|
|
|
|
* @return 结果
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
@DS("#header.poolName")
|
|
|
|
|
// @DS("#header.poolName")
|
|
|
|
|
public int insertWmsProductPutTray(WmsProductPutTray wmsProductPutTray) {
|
|
|
|
|
WmsProductPutTrayCode wmsProductPutTrayCode = wmsProductPutTrayCodeMapper.selectWmsProductPutTrayCodeBySn(wmsProductPutTray.getSn());
|
|
|
|
|
if (wmsProductPutTrayCode.getRelatStatus().equals("0")){
|
|
|
|
|
ValueOperations<String, String> valueOperations = redisTemplate.opsForValue();
|
|
|
|
|
String workOrder = valueOperations.get("workOrder");
|
|
|
|
|
WmsProductPut wmsProductPut = wmsProductPutMapper.selectWmsProductPutByWorkOrder(workOrder);
|
|
|
|
|
wmsProductPutTray.setStorageId(IdUtils.fastSimpleUUID());
|
|
|
|
|
wmsProductPutTray.setWorkOrder(workOrder);
|
|
|
|
|
wmsProductPutTray.setProductOrder(wmsProductPut.getProductOrder());
|
|
|
|
|
wmsProductPutTray.setWhCode(wmsProductPut.getWhCode());
|
|
|
|
|
wmsProductPutTray.setWaCode(wmsProductPut.getWaCode());
|
|
|
|
|
wmsProductPutTray.setBatchNumber(wmsProductPut.getBatchNumber());
|
|
|
|
|
}else {
|
|
|
|
|
throw new ServiceException("该托盘已经被占用!");
|
|
|
|
|
//todo 需要修改
|
|
|
|
|
DynamicDataSourceContextHolder.push("ds_1000");
|
|
|
|
|
// WmsProductPutTrayCode wmsProductPutTrayCode = wmsProductPutTrayCodeMapper.selectWmsProductPutTrayCodeBySn(wmsProductPutTray.getSn());
|
|
|
|
|
List<WmsProductPutTrayCode> wmsProductPutTrayCodes = wmsProductPutTrayCodeMapper.selectWmsProductPutTrayCodeBySn1(wmsProductPutTray.getSn());
|
|
|
|
|
ValueOperations<String, String> valueOperations = redisTemplate.opsForValue();
|
|
|
|
|
String workOrder = valueOperations.get("workOrder");
|
|
|
|
|
WmsProductPut wmsProductPut = wmsProductPutMapper.selectWmsProductPutByWorkOrder(workOrder);
|
|
|
|
|
for (WmsProductPutTrayCode wmsProductPutTrayCode : wmsProductPutTrayCodes) {
|
|
|
|
|
if (wmsProductPutTrayCode.getRelatStatus().equals("0")){
|
|
|
|
|
wmsProductPutTray.setStorageId(IdUtils.fastSimpleUUID());
|
|
|
|
|
wmsProductPutTray.setWorkOrder(workOrder);
|
|
|
|
|
wmsProductPutTray.setProductOrder(wmsProductPut.getProductOrder());
|
|
|
|
|
wmsProductPutTray.setWhCode(wmsProductPut.getWhCode());
|
|
|
|
|
wmsProductPutTray.setWaCode(wmsProductPut.getWaCode());
|
|
|
|
|
wmsProductPutTray.setBatchNumber(wmsProductPut.getBatchNumber());
|
|
|
|
|
}else {
|
|
|
|
|
throw new ServiceException("该托盘已经被占用!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return wmsProductPutTrayMapper.insertWmsProductPutTray(wmsProductPutTray);
|
|
|
|
|
}
|
|
|
|
@ -135,8 +143,10 @@ public class WmsProductPutTrayServiceImpl implements IWmsProductPutTrayService {
|
|
|
|
|
* 根据托盘号删除接口
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
@DS("#header.poolName")
|
|
|
|
|
// @DS("#header.poolName")
|
|
|
|
|
public int deleteWmsProductPutTrayBySn(String sn, String workOrder) {
|
|
|
|
|
//todo 需要修改
|
|
|
|
|
DynamicDataSourceContextHolder.push("ds_1000");
|
|
|
|
|
return wmsProductPutTrayMapper.deleteWmsProductPutTrayBySn(sn,workOrder);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -145,8 +155,11 @@ public class WmsProductPutTrayServiceImpl implements IWmsProductPutTrayService {
|
|
|
|
|
* 手持确认入库批量添加
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
@DS("#header.poolName")
|
|
|
|
|
// @DS("#header.poolName")
|
|
|
|
|
public int insertWmsProductPutTrays(List<WmsProductPutTray> wmsProductPutTrays){
|
|
|
|
|
//todo 需要修改
|
|
|
|
|
DynamicDataSourceContextHolder.push("ds_1000");
|
|
|
|
|
|
|
|
|
|
ValueOperations<String,String> valueOperations = redisTemplate.opsForValue();
|
|
|
|
|
String workOrder = valueOperations.get("workOrder");
|
|
|
|
|
WmsProductPut wmsProductPut = wmsProductPutMapper.selectWmsProductPutByWorkOrder(workOrder);
|
|
|
|
@ -170,7 +183,7 @@ public class WmsProductPutTrayServiceImpl implements IWmsProductPutTrayService {
|
|
|
|
|
wmsFpStorageNewsMapper.insertWmsFpStorageNews(wmsFpStorageNews1);
|
|
|
|
|
}else {
|
|
|
|
|
//加库存数量
|
|
|
|
|
BigDecimal putQuantity = new BigDecimal(wmsProductPutTray.getNumber());
|
|
|
|
|
BigDecimal putQuantity = new BigDecimal(wmsProductPut.getPutQuantity());
|
|
|
|
|
wmsFpStorageNews.setAmount(wmsFpStorageNews.getAmount().add(putQuantity));
|
|
|
|
|
wmsFpStorageNews.setUpdateBy(SecurityContextHolder.getUserName());
|
|
|
|
|
wmsFpStorageNews.setUpdateTime(new Date());
|
|
|
|
@ -201,7 +214,7 @@ public class WmsProductPutTrayServiceImpl implements IWmsProductPutTrayService {
|
|
|
|
|
// wmsFpStorageNews.setUpdateTime(new Date());
|
|
|
|
|
// wmsFpStorageNewsMapper.updateWmsFpStorageNews(wmsFpStorageNews);
|
|
|
|
|
// }
|
|
|
|
|
//生成库存明细
|
|
|
|
|
//todo 生成库存明细
|
|
|
|
|
for (WmsProductPutTray wmsProductPutTray : wmsProductPutTrays) {
|
|
|
|
|
WmsFpStorageNewsSn wmsFpStorageNewsSn1 = wmsFpStorageNewsSnMapper.selectWmsFpStorageNewsSnBySnAndProductCodeAndWlCode(wmsProductPut.getProductCode(), wmsProductPutTray.getSn(), wmsProductPutTray.getWlCode());
|
|
|
|
|
WmsFpStorageNewsSn wmsFpStorageNewsSn = new WmsFpStorageNewsSn();
|
|
|
|
@ -210,7 +223,7 @@ public class WmsProductPutTrayServiceImpl implements IWmsProductPutTrayService {
|
|
|
|
|
wmsFpStorageNewsSn.setWhCode(wmsProductPut.getWhCode());
|
|
|
|
|
wmsFpStorageNewsSn.setWaCode(wmsProductPut.getWaCode());
|
|
|
|
|
wmsFpStorageNewsSn.setWlCode(wmsProductPutTray.getWlCode());
|
|
|
|
|
wmsFpStorageNewsSn.setOrderNo(IdUtils.fastSimpleUUID());
|
|
|
|
|
// wmsFpStorageNewsSn.setOrderNo(IdUtils.fastSimpleUUID());
|
|
|
|
|
wmsFpStorageNewsSn.setProductName(wmsProductPut.getProductName());
|
|
|
|
|
wmsFpStorageNewsSn.setProductCode(wmsProductPut.getProductCode());
|
|
|
|
|
wmsFpStorageNewsSn.setSn(wmsProductPutTray.getSn());
|
|
|
|
@ -218,6 +231,7 @@ public class WmsProductPutTrayServiceImpl implements IWmsProductPutTrayService {
|
|
|
|
|
wmsFpStorageNewsSn.setAmount(number);
|
|
|
|
|
wmsFpStorageNewsSn.setCreateBy(SecurityContextHolder.getUserName());
|
|
|
|
|
wmsFpStorageNewsSn.setCreateTime(new Date());
|
|
|
|
|
wmsFpStorageNewsSn.setBatchNumber(wmsProductPutTray.getBatchNumber());
|
|
|
|
|
wmsFpStorageNewsSnMapper.insertWmsFpStorageNewsSn(wmsFpStorageNewsSn);
|
|
|
|
|
}else {
|
|
|
|
|
//加库存数量
|
|
|
|
@ -251,11 +265,29 @@ public class WmsProductPutTrayServiceImpl implements IWmsProductPutTrayService {
|
|
|
|
|
}
|
|
|
|
|
//todo 增加托盘上的数量
|
|
|
|
|
for (WmsProductPutTray wmsProductPutTray : wmsProductPutTrays) {
|
|
|
|
|
WmsProductPutTrayCode wmsProductPutTrayCode = wmsProductPutTrayCodeMapper.selectWmsProductPutTrayCodeBySn(wmsProductPutTray.getSn());
|
|
|
|
|
wmsProductPutTrayCode.setRelatStatus("1");
|
|
|
|
|
wmsProductPutTrayCode.setNumber(wmsProductPutTrayCode.getNumber()+Integer.parseInt(wmsProductPutTray.getNumber()));
|
|
|
|
|
wmsProductPutTrayCodeMapper.updateWmsProductPutTrayCode(wmsProductPutTrayCode);
|
|
|
|
|
//WmsProductPutTrayCode wmsProductPutTrayCode = wmsProductPutTrayCodeMapper.selectWmsProductPutTrayCodeBySn(wmsProductPutTray.getSn());
|
|
|
|
|
List<WmsProductPutTrayCode> wmsProductPutTrayCodes = wmsProductPutTrayCodeMapper.selectWmsProductPutTrayCodeBySn1(wmsProductPutTray.getSn());
|
|
|
|
|
for (WmsProductPutTrayCode productPutTrayCode : wmsProductPutTrayCodes) {
|
|
|
|
|
productPutTrayCode.setRelatStatus("1");
|
|
|
|
|
productPutTrayCode.setNumber(productPutTrayCode.getNumber()+Integer.parseInt(wmsProductPutTray.getNumber()));
|
|
|
|
|
wmsProductPutTrayCodeMapper.updateWmsProductPutTrayCode(productPutTrayCode);
|
|
|
|
|
}
|
|
|
|
|
// wmsProductPutTrayCode.setRelatStatus("1");
|
|
|
|
|
// wmsProductPutTrayCode.setNumber(wmsProductPutTrayCode.getNumber()+Integer.parseInt(wmsProductPutTray.getNumber()));
|
|
|
|
|
// wmsProductPutTrayCodeMapper.updateWmsProductPutTrayCode(wmsProductPutTrayCode);
|
|
|
|
|
}
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 根据报工单号查询
|
|
|
|
|
* @param workOrder
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public List<WmsProductPutTray> selectWmsProductPutTraysWorkOrder(String workOrder) {
|
|
|
|
|
//todo 需要修改
|
|
|
|
|
DynamicDataSourceContextHolder.push("ds_1000");
|
|
|
|
|
return wmsProductPutTrayMapper.selectWmsProductPutTrayByWorkOrder(workOrder);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|