|
|
|
@ -1,12 +1,19 @@
|
|
|
|
|
package com.op.wms.service.impl;
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
|
|
|
|
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
|
|
|
|
|
import com.op.common.core.utils.uuid.IdUtils;
|
|
|
|
|
import com.op.wms.domain.*;
|
|
|
|
|
import com.op.wms.mapper.WmsOdsMateStorageNewsMapper;
|
|
|
|
|
import com.op.wms.mapper.WmsOdsMateStorageNewsSnMapper;
|
|
|
|
|
import com.op.wms.mapper.WmsRawOrderInSnMapper;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import com.op.wms.mapper.OdsProcureOrderMapper;
|
|
|
|
|
import com.op.wms.domain.OdsProcureOrder;
|
|
|
|
|
import com.op.wms.service.IOdsProcureOrderService;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -19,6 +26,12 @@ import com.op.wms.service.IOdsProcureOrderService;
|
|
|
|
|
public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService {
|
|
|
|
|
@Autowired
|
|
|
|
|
private OdsProcureOrderMapper odsProcureOrderMapper;
|
|
|
|
|
@Autowired
|
|
|
|
|
private WmsRawOrderInSnMapper wmsRawOrderInSnMapper;
|
|
|
|
|
@Autowired
|
|
|
|
|
private WmsOdsMateStorageNewsSnMapper wmsOdsMateStorageNewsSnMapper;
|
|
|
|
|
@Autowired
|
|
|
|
|
private WmsOdsMateStorageNewsMapper wmsOdsMateStorageNewsMapper;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询包材采购单
|
|
|
|
@ -91,4 +104,118 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService {
|
|
|
|
|
public int deleteOdsProcureOrderByID(String ID) {
|
|
|
|
|
return odsProcureOrderMapper.deleteOdsProcureOrderByID(ID);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
// @DS("#header.poolName")
|
|
|
|
|
public List<OdsProcureOrder> PurchaseOrderPda(OdsProcureOrder odsProcureOrder) {
|
|
|
|
|
DynamicDataSourceContextHolder.push("ds_" + odsProcureOrder.getFactoryCode());
|
|
|
|
|
return odsProcureOrderMapper.selectOdsProcureOrderList(odsProcureOrder);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
//@DS("#header.poolName")
|
|
|
|
|
public int PurchaseOrderdeliPda(OdsProcureOrder odsProcureOrder) {
|
|
|
|
|
//收货记录--rawOrderInSnId。修改收货数量
|
|
|
|
|
DynamicDataSourceContextHolder.push("ds_" + odsProcureOrder.getFactoryCode());
|
|
|
|
|
|
|
|
|
|
OdsProcureOrder order= odsProcureOrderMapper.selectOdsProcureOrderByID(odsProcureOrder.getID());
|
|
|
|
|
//wms_raw_order_in_sn
|
|
|
|
|
WmsRawOrderInSn wmsRawOrderInSn=new WmsRawOrderInSn();
|
|
|
|
|
wmsRawOrderInSn.setRawOrderInSnId(IdUtils.fastSimpleUUID());
|
|
|
|
|
wmsRawOrderInSn.setUserDefined1("1");//出入库
|
|
|
|
|
wmsRawOrderInSn.setUserDefined2(odsProcureOrder.getIncomeBatchNo());//批次
|
|
|
|
|
wmsRawOrderInSn.setWhCode(odsProcureOrder.getWhCode());//厂库编号
|
|
|
|
|
wmsRawOrderInSn.setPoNo(order.getProcureCode());//采购单号
|
|
|
|
|
// wmsRawOrderInSn.setPoLine(odsProcureOrder.getPoLine());//行项目
|
|
|
|
|
wmsRawOrderInSn.setMaterialCode(odsProcureOrder.getMaterialCode());
|
|
|
|
|
wmsRawOrderInSn.setMaterialDesc(odsProcureOrder.getMaterialDesc());
|
|
|
|
|
wmsRawOrderInSn.setAmount(odsProcureOrder.getPlanNumber());
|
|
|
|
|
wmsRawOrderInSn.setCreateBy(odsProcureOrder.getCreateBy());
|
|
|
|
|
wmsRawOrderInSn.setGmtCreate(new Date());
|
|
|
|
|
wmsRawOrderInSn.setActiveFlag("1");
|
|
|
|
|
wmsRawOrderInSn.setUserDefined4(order.getUnit());//单位
|
|
|
|
|
wmsRawOrderInSn.setSn(odsProcureOrder.getSn());//托盘号
|
|
|
|
|
wmsRawOrderInSn.setFactoryCode(odsProcureOrder.getSiteCode());
|
|
|
|
|
wmsRawOrderInSn.setUserDefined3(order.getID());
|
|
|
|
|
wmsRawOrderInSnMapper.insertWmsRawOrderInSn(wmsRawOrderInSn);
|
|
|
|
|
//插入收货记录
|
|
|
|
|
//如果收货完成了的话,就插入信息收货完成
|
|
|
|
|
odsProcureOrder.setOrderStatus("1");
|
|
|
|
|
BigDecimal result =order.getRealityNumber().add(odsProcureOrder.getPlanNumber());
|
|
|
|
|
if (result.equals(order.getPlanNumber())){
|
|
|
|
|
odsProcureOrder.setOrderStatus("2");
|
|
|
|
|
}
|
|
|
|
|
Integer tem= odsProcureOrderMapper.updateRealityNuById(odsProcureOrder);
|
|
|
|
|
return tem;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
//@DS("#header.poolName")
|
|
|
|
|
public List<WmsRawOrderInSn> PurchaseOrderdetailPda(WmsRawOrderInSn wmsRawOrderInSn) {
|
|
|
|
|
DynamicDataSourceContextHolder.push("ds_" + wmsRawOrderInSn.getFactoryCode());
|
|
|
|
|
wmsRawOrderInSn.setActiveFlag("1");
|
|
|
|
|
//u3备注
|
|
|
|
|
return wmsRawOrderInSnMapper.selectWmsRawOrderInSnList(wmsRawOrderInSn);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<WmsRawOrderInSn> PurchaseOrderWarehousingPda(WmsRawOrderInSn wmsRawOrderInSn) {
|
|
|
|
|
DynamicDataSourceContextHolder.push("ds_" + wmsRawOrderInSn.getFactoryCode());
|
|
|
|
|
wmsRawOrderInSn.setActiveFlag("1");
|
|
|
|
|
//u3备注
|
|
|
|
|
return wmsRawOrderInSnMapper.selectWmsRawOrderInSnList(wmsRawOrderInSn);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void PurchaseOrderRKPda(WmsRawOrderInSn wmsRawOrderInSn) {
|
|
|
|
|
//入库//修改备用1为2
|
|
|
|
|
DynamicDataSourceContextHolder.push("ds_" + wmsRawOrderInSn.getFactoryCode());
|
|
|
|
|
//判断如果收过就不能收了
|
|
|
|
|
// if("2".equals(wmsRawOrderInSn.getUserDefined1())){//已经入库--前端判断吧
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
WmsOdsMateStorageNewsSn wmsOdsMateStorageNewsSn=new WmsOdsMateStorageNewsSn();
|
|
|
|
|
wmsOdsMateStorageNewsSn.setWhCode(wmsRawOrderInSn.getWhCode());//仓库编码
|
|
|
|
|
wmsOdsMateStorageNewsSn.setWlCode(wmsRawOrderInSn.getWlCode());//库位编码
|
|
|
|
|
wmsOdsMateStorageNewsSn.setMaterialCode(wmsRawOrderInSn.getMaterialCode());
|
|
|
|
|
wmsOdsMateStorageNewsSn.setMaterialDesc(wmsRawOrderInSn.getMaterialDesc());
|
|
|
|
|
wmsOdsMateStorageNewsSn.setSn(wmsRawOrderInSn.getSn());
|
|
|
|
|
wmsOdsMateStorageNewsSn.setAmount(wmsRawOrderInSn.getAmount());
|
|
|
|
|
wmsOdsMateStorageNewsSn.setCreateBy(wmsRawOrderInSn.getCreateBy());
|
|
|
|
|
wmsOdsMateStorageNewsSn.setGmtCreate(new Date());
|
|
|
|
|
wmsOdsMateStorageNewsSn.setFactoryCode(wmsRawOrderInSn.getFactoryCode());
|
|
|
|
|
wmsOdsMateStorageNewsSn.setSapFactoryCode(wmsRawOrderInSn.getFactoryCode());
|
|
|
|
|
wmsOdsMateStorageNewsSnMapper.insertWmsOdsMateStorageNewsSn(wmsOdsMateStorageNewsSn);
|
|
|
|
|
//修改库存
|
|
|
|
|
//2,修改库存---/加库存数量-/-冻结数量
|
|
|
|
|
WmsOdsEmStorageNews wmsOdsEmStorageNews=new WmsOdsEmStorageNews();
|
|
|
|
|
wmsOdsEmStorageNews.setWhCode(wmsRawOrderInSn.getWhCode());//仓库编码
|
|
|
|
|
wmsOdsEmStorageNews.setWlCode(wmsRawOrderInSn.getWlCode());//库位编码
|
|
|
|
|
wmsOdsEmStorageNews.setMaterialCode(wmsRawOrderInSn.getMaterialCode());
|
|
|
|
|
wmsOdsEmStorageNews.setAmount(wmsRawOrderInSn.getAmount());
|
|
|
|
|
//添加库存--这个要有个判断有没有这个库存如果没有的话,就插入
|
|
|
|
|
WmsOdsMateStorageNews wmsOdsMateStorageNews= wmsOdsMateStorageNewsMapper.selectByWhCodeAndMate(wmsOdsEmStorageNews);
|
|
|
|
|
if (wmsOdsMateStorageNews==null){
|
|
|
|
|
WmsOdsMateStorageNews wmsOdsMateStorageNews1=new WmsOdsMateStorageNews();
|
|
|
|
|
wmsOdsMateStorageNews1.setStorageId(IdUtils.fastSimpleUUID());
|
|
|
|
|
wmsOdsMateStorageNews1.setWhCode(wmsRawOrderInSn.getWhCode());
|
|
|
|
|
wmsOdsMateStorageNews1.setWlCode(wmsRawOrderInSn.getWlCode());
|
|
|
|
|
wmsOdsMateStorageNews1.setAmount(wmsRawOrderInSn.getAmount());
|
|
|
|
|
wmsOdsMateStorageNews1.setStorageAmount(wmsRawOrderInSn.getAmount());
|
|
|
|
|
wmsOdsMateStorageNews1.setMaterialCode(wmsRawOrderInSn.getMaterialCode());
|
|
|
|
|
wmsOdsMateStorageNews1.setMaterialDesc(wmsRawOrderInSn.getMaterialDesc());
|
|
|
|
|
wmsOdsMateStorageNews1.setStorageType("BC");
|
|
|
|
|
wmsOdsMateStorageNews1.setCreateBy(wmsRawOrderInSn.getCreateBy());
|
|
|
|
|
wmsOdsMateStorageNews1.setGmtCreate(new Date());
|
|
|
|
|
wmsOdsMateStorageNews1.setActiveFlag("1");
|
|
|
|
|
wmsOdsMateStorageNews1.setFactoryCode(wmsRawOrderInSn.getFactoryCode());
|
|
|
|
|
wmsOdsMateStorageNews1.setSapFactoryCode(wmsRawOrderInSn.getSapFactoryCode());
|
|
|
|
|
wmsOdsMateStorageNews1.setUserDefined1(wmsRawOrderInSn.getUserDefined4());//单位
|
|
|
|
|
wmsOdsMateStorageNewsMapper.insertWmsOdsMateStorageNews(wmsOdsMateStorageNews1);
|
|
|
|
|
}else {
|
|
|
|
|
wmsOdsMateStorageNewsSnMapper.updateAdd(wmsOdsEmStorageNews);
|
|
|
|
|
}
|
|
|
|
|
wmsRawOrderInSnMapper.updateU1Byid(wmsRawOrderInSn);
|
|
|
|
|
//修改库存--加,并且为冻结的,sap过账后再解
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|