feat 辅材入库区分到货单
This commit is contained in:
parent
c52375a538
commit
4d8f947344
@ -5,8 +5,13 @@ import com.cim.idm.framework.IDMFrameServiceProxy;
|
||||
import com.cim.idm.framework.data.EventInfo;
|
||||
import com.cim.idm.framework.exception.IDMFrameDBErrorSignal;
|
||||
import com.cim.idm.framework.util.time.TimeStampUtil;
|
||||
import com.cim.idm.model.dto.delivery.StoreDetailDto;
|
||||
import com.cim.idm.model.po.MaterialReceiveRequest;
|
||||
import com.cim.idm.model.po.delivery.MaterialDelivery;
|
||||
import com.cim.idm.model.vo.DeliveryReceiveDetailVo;
|
||||
import com.cim.idm.mwmsextend.materialpacking.service.MaterialPackingServiceImpl;
|
||||
import com.cim.idm.mwmsextend.materialreceiverequest.service.MaterialReceiveRequestServiceImpl;
|
||||
import com.cim.idm.service.IDeliveryService;
|
||||
import com.cim.idm.service.Impl.NCWServiceImpl;
|
||||
import com.cim.idm.service.Impl.SDKMaterialPackingServiceImpl;
|
||||
import com.cim.idm.utils.AjaxResult;
|
||||
@ -44,6 +49,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Timestamp;
|
||||
import java.text.ParseException;
|
||||
@ -56,6 +62,9 @@ import java.util.*;
|
||||
@EnableAutoConfiguration
|
||||
public class NoChargeStockIn {
|
||||
|
||||
@Resource
|
||||
private IDeliveryService deliveryService;
|
||||
|
||||
|
||||
private static Log log = LogFactory.getLog(MaterialReceiveRequestServiceImpl.class);
|
||||
SDKMaterialPackingServiceImpl SDKMP=new SDKMaterialPackingServiceImpl();
|
||||
@ -65,14 +74,14 @@ public class NoChargeStockIn {
|
||||
|
||||
@Transactional
|
||||
@RequestMapping(value = "/NoChargeStockIn", method = RequestMethod.POST)
|
||||
public AjaxResult NoChargeStockIn(@RequestBody JSONObject in ) throws CustomException {
|
||||
public AjaxResult NoChargeStockIn(@RequestBody JSONObject in ) throws Exception {
|
||||
// 将字符串转换为JSONArray对象
|
||||
|
||||
String ERPFACTORY="";
|
||||
String ERPLOCATION="";
|
||||
String LOCATIONNAME="";
|
||||
String RECEIVEREQUESTNAME="";
|
||||
String RECEIVEREQUESTDETAILNAME="";
|
||||
// String RECEIVEREQUESTNAME="";
|
||||
// String RECEIVEREQUESTDETAILNAME="";
|
||||
String MATERIALSPECNAME="";
|
||||
String MATERIALUNITDESC="";
|
||||
String MATERIALUNIT="";
|
||||
@ -86,6 +95,12 @@ public class NoChargeStockIn {
|
||||
String sdkid="";
|
||||
String commitDate = "";
|
||||
String opCode = "";
|
||||
// 判定是否是到货单
|
||||
StoreDetailDto storeDetailDto = new StoreDetailDto();
|
||||
storeDetailDto.setSiteName((String)in.get("SITENAME"));
|
||||
storeDetailDto.setDocumentName((String)in.get("RECEIVEREQUESTNAME"));
|
||||
MaterialDelivery byKey = deliveryService.getByKey(storeDetailDto);
|
||||
Boolean isDelivery = Objects.nonNull(byKey);
|
||||
//1、首先生成入库单
|
||||
//获取抬头文本
|
||||
try {
|
||||
@ -173,8 +188,6 @@ public class NoChargeStockIn {
|
||||
ERPFACTORY=(String) NoPoList.get("ERPFACTORY");
|
||||
ERPLOCATION=(String) NoPoList.get("ERPLOCATION");
|
||||
LOCATIONNAME= (NoPoList.get("LOCATIONNAME") == null || "null".equals(NoPoList.get("LOCATIONNAME").toString())) ? "" : NoPoList.get("LOCATIONNAME").toString();
|
||||
RECEIVEREQUESTNAME=(String) NoPoList.get("RECEIVEREQUESTNAME");
|
||||
RECEIVEREQUESTDETAILNAME=(String) NoPoList.get("RECEIVEREQUESTDETAILNAME");
|
||||
MATERIALSPECNAME=(String) NoPoList.get("MATERIALSPECNAME");
|
||||
MATERIALUNITDESC=(String) NoPoList.get("MATERIALUNITDESC");
|
||||
MATERIALUNIT=(String) NoPoList.get("MATERIALUNIT");
|
||||
@ -189,13 +202,16 @@ public class NoChargeStockIn {
|
||||
sdkid=(String) NoPoList.get("SDK_ID");
|
||||
if(ThisAcceptNumber!=""&&ThisAcceptNumber!=null&&ThisAcceptNumber!="0")
|
||||
{
|
||||
// 获取单据详情
|
||||
List<DeliveryReceiveDetailVo> receiveByMaterialSpec = deliveryService.getReceiveByMaterialSpec(storeDetailDto.getDocumentName(), MATERIALSPECNAME, isDelivery);
|
||||
if (!receiveByMaterialSpec.isEmpty()) {
|
||||
for (DeliveryReceiveDetailVo vo : receiveByMaterialSpec) {
|
||||
//2、获取EventInfo
|
||||
makeEventInfo = new EventInfoUtil().makeEventInfo("NoChargeStockIn", user, "NoChargeStockIn", "", "");
|
||||
//4、写入入库单明细
|
||||
try {
|
||||
CreateMaterialReceiveRequestAct(makeEventInfo,"SDK",RECEIVEREQUESTNAME,RECEIVEREQUESTDETAILNAME,MAKEDATE,receiveAct,"NoPO",ThisAcceptNumber,MATERIALSPECNAME);
|
||||
CreateMaterialReceiveRequestAct(makeEventInfo,"SDK",vo.getReceiveRequestName(),vo.getReceiveRequestDetailName(),MAKEDATE,receiveAct,"NoPO",ThisAcceptNumber,MATERIALSPECNAME);
|
||||
} catch (CustomException | ParseException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
//5、查询物料是否启用批次
|
||||
@ -207,41 +223,35 @@ public class NoChargeStockIn {
|
||||
String IQCFLAG=(String) list.get(0).get("IQCFLAG");
|
||||
//6、创建标签
|
||||
try {
|
||||
String lastEventTimeKey= Packing( makeEventInfo, "SDK","", ThisAcceptNumber, "1",ThisAcceptNumber, "N",RECEIVEREQUESTNAME,RECEIVEREQUESTDETAILNAME,MATERIALSPECNAME,receiveAct, MAKEDATE, "","", "","", ERPLOCATION, ERPFACTORY,"", "", "","","",LOCATIONNAME,"","",MATERIALUNIT,IsBatch,IQCFLAG,sdkid);
|
||||
Packing( makeEventInfo, "SDK","", ThisAcceptNumber, "1",ThisAcceptNumber, "N",vo.getReceiveRequestName(),vo.getReceiveRequestDetailName(),MATERIALSPECNAME,receiveAct, MAKEDATE, "","", "","", ERPLOCATION, ERPFACTORY,"", "", "","","",LOCATIONNAME,"","",MATERIALUNIT,IsBatch,IQCFLAG,sdkid);
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//7、过账
|
||||
// 采购单
|
||||
List<MaterialReceiveRequest> requests = new ArrayList<>();
|
||||
if (isDelivery) {
|
||||
// 到货单据
|
||||
requests = deliveryService.getReceiveByDelivery(storeDetailDto);
|
||||
} else {
|
||||
requests.add(deliveryService.getReceiveByKey(storeDetailDto));
|
||||
}
|
||||
for (MaterialReceiveRequest request : requests) {
|
||||
String billcode = null;
|
||||
try {
|
||||
// billcode = ncServer.PurStockIn(RECEIVEREQUESTNAME,"SDK",user,receiveAct);
|
||||
//判断单据类型调用不同的NC接口
|
||||
String sql = "SELECT m.RECEIVEREQUESTTYPE FROM MATERIALRECEIVEREQUEST m WHERE m.RECEIVEREQUESTNAME = :RECEIVEREQUESTNAME";
|
||||
Map<String, Object> hashMap = new HashMap<String,Object> ();
|
||||
hashMap.put("RECEIVEREQUESTNAME", RECEIVEREQUESTNAME);
|
||||
List<Map<String, Object>> queryForList = IDMFrameServiceProxy.getSqlTemplate().queryForList(sql, hashMap);
|
||||
if (queryForList != null && queryForList.size() > 0) {
|
||||
String type = queryForList.get(0).get("RECEIVEREQUESTTYPE").toString();
|
||||
switch (type) {
|
||||
switch (request.getReceiveRequestType()) {
|
||||
case "ZK4A" : //其他入库
|
||||
billcode = ncServer.qtrNoInvoice(RECEIVEREQUESTNAME, "SDK", receiveAct,user,commitDate,opCode);
|
||||
billcode = ncServer.qtrNoInvoice(request.getReceiveRequestName(), "SDK", receiveAct,user,commitDate,opCode);
|
||||
break;
|
||||
case "45" : //采购入库
|
||||
billcode = ncServer.PurStockIn(RECEIVEREQUESTNAME, "SDK",user,receiveAct,commitDate,opCode);
|
||||
billcode = ncServer.PurStockIn(request.getReceiveRequestName(), "SDK",user,receiveAct,commitDate,opCode);
|
||||
break;
|
||||
default :
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
throw new CustomException("找不到单据" + RECEIVEREQUESTNAME);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (billcode == null || "".equals(billcode)) {
|
||||
return AjaxResult.me().setErrorCode(500).setSuccess(false).setMessage("NC过账失败");
|
||||
}
|
||||
@ -252,37 +262,8 @@ public class NoChargeStockIn {
|
||||
SDKMP.SaveUnDoInfo(billcode,commitDate);//传值错误,导致凭证信息未存储,已修改。zd.2024.9.24
|
||||
//10、更新库存状态
|
||||
SDKMP.updateStockState(receiveAct,makeEventInfo,billcode);
|
||||
|
||||
return AjaxResult.me().setMessage("入库成功");
|
||||
}
|
||||
|
||||
|
||||
public static EventInfo makeEventInfo( String eventName, String eventUser, String eventComment,
|
||||
String reasonCodeType, String reasonCode )
|
||||
{
|
||||
EventInfo eventInfo = new EventInfo();
|
||||
|
||||
eventInfo.setBehaviorName( "" );
|
||||
eventInfo.setEventName( eventName );
|
||||
eventInfo.setEventUser( eventUser );
|
||||
|
||||
if ( eventComment == null )
|
||||
eventComment = "";
|
||||
|
||||
eventInfo.setEventComment( eventComment );
|
||||
// Do Not Check TimeKey Validation
|
||||
eventInfo.setCheckTimekeyValidation(false);
|
||||
if ( reasonCodeType == null )
|
||||
reasonCodeType = "";
|
||||
|
||||
eventInfo.setReasonCodeType( reasonCodeType );
|
||||
|
||||
if ( reasonCode == null )
|
||||
reasonCode = "";
|
||||
|
||||
eventInfo.setReasonCode( reasonCode );
|
||||
|
||||
return eventInfo;
|
||||
return AjaxResult.me().setMessage("入库成功");
|
||||
}
|
||||
|
||||
/*
|
||||
@ -360,7 +341,6 @@ public class NoChargeStockIn {
|
||||
* Name : CreateMaterialReceiveRequestAct Desc :
|
||||
* CreateMaterialReceiveRequestAct Author : boe cim dev. Date : 2016.02.17
|
||||
*/
|
||||
|
||||
public void CreateMaterialReceiveRequestAct(EventInfo eventInfo,
|
||||
String siteName, String receiveRequestName,
|
||||
String ReceiveRequestDetailName, String makeDate,
|
||||
|
@ -84,6 +84,24 @@ public interface DeliveryDao {
|
||||
*/
|
||||
List<MaterialReceiveRequest> getReceiveByDelivery(@Param("dto") StoreDetailDto storeDetailDto);
|
||||
|
||||
/**
|
||||
* 根据单号和物料获取单据详情
|
||||
* @param documentName 单据
|
||||
* @param materialSpec 物料
|
||||
* @return 单据详情
|
||||
*/
|
||||
List<DeliveryReceiveDetailVo> getReceiveByMaterialSpec(@Param("documentName") String documentName,
|
||||
@Param("materialSpec") String materialSpec);
|
||||
|
||||
/**
|
||||
* 根据单号和物料获取到货单单据详情
|
||||
* @param documentName 单据
|
||||
* @param materialSpec 物料
|
||||
* @return 单据详情
|
||||
*/
|
||||
List<DeliveryReceiveDetailVo> getDeliveryByMaterialSpec(@Param("documentName") String documentName,
|
||||
@Param("materialSpec") String materialSpec);
|
||||
|
||||
/**
|
||||
* 根据到库单获取采购单名称
|
||||
* @param nameList 到库单
|
||||
|
@ -10,6 +10,8 @@ public class DeliveryRelationDto {
|
||||
private Integer deliveryNum = 0;
|
||||
// 采购单名称
|
||||
private String receiveRequestName;
|
||||
// 采购单明细
|
||||
private String receiveRequestDetailName;
|
||||
// 料号
|
||||
private String materialSpecName;
|
||||
}
|
||||
|
@ -11,6 +11,8 @@ public class MaterialDeliveryReceive {
|
||||
private String deliveryNum;
|
||||
// 采购单号
|
||||
private String receiveRequestName;
|
||||
// 采购单明细号
|
||||
private String receiveRequestDetailName;
|
||||
// 料号
|
||||
private String materialSpecName;
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import lombok.Data;
|
||||
public class DeliveryReceiveDetailVo {
|
||||
|
||||
private String receiveRequestName;
|
||||
private String receiveRequestDetailName;
|
||||
private String materialSpecName;
|
||||
private double requestQuantity;
|
||||
private double deliveryNum;
|
||||
|
@ -79,6 +79,16 @@ public interface IDeliveryService {
|
||||
*/
|
||||
List<MaterialReceiveRequest> getReceiveByDelivery(StoreDetailDto storeDetailDto);
|
||||
|
||||
|
||||
/**
|
||||
* 根据单号和物料获取单据详情
|
||||
* @param documentName 单据
|
||||
* @param materialSpec 物料
|
||||
* @param isDelivery 是否到库
|
||||
* @return 单据详情
|
||||
*/
|
||||
List<DeliveryReceiveDetailVo> getReceiveByMaterialSpec(String documentName, String materialSpec, Boolean isDelivery);
|
||||
|
||||
/**
|
||||
* 根据到库单获取采购单名称
|
||||
* @param nameList 到库单
|
||||
|
@ -103,6 +103,18 @@ public class DeliveryServiceImpl implements IDeliveryService {
|
||||
return deliveryDao.getReceiveByDelivery(storeDetailDto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeliveryReceiveDetailVo> getReceiveByMaterialSpec(String documentName, String materialSpec, Boolean isDelivery) {
|
||||
List<DeliveryReceiveDetailVo> voList;
|
||||
if (Boolean.TRUE.equals(isDelivery)) {
|
||||
// 到货单
|
||||
voList = deliveryDao.getDeliveryByMaterialSpec(documentName, materialSpec);
|
||||
} else {
|
||||
voList = deliveryDao.getReceiveByMaterialSpec(documentName, materialSpec);
|
||||
}
|
||||
return voList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeliveryReceiveDetailVo> getReceiveDetail(List<String> nameList) {
|
||||
return deliveryDao.getReceiveDetail(nameList);
|
||||
|
@ -10,7 +10,7 @@
|
||||
<insert id="createRelation">
|
||||
INSERT ALL
|
||||
<foreach item="item" index="index" collection="receiveList">
|
||||
INTO MATERIALDELIVERYRECEIVE (RECEIVEREQUESTNAME, DELIVERYNAME, DELIVERYNUM, MATERIALSPECNAME) VALUES (#{item.receiveRequestName}, #{item.deliveryName}, #{item.deliveryNum}, #{item.materialSpecName})
|
||||
INTO MATERIALDELIVERYRECEIVE (RECEIVEREQUESTNAME, DELIVERYNAME, DELIVERYNUM, MATERIALSPECNAME, RECEIVEREQUESTDETAILNAME) VALUES (#{item.receiveRequestName}, #{item.deliveryName}, #{item.deliveryNum}, #{item.materialSpecName}, #{item.receiveRequestDetailName})
|
||||
</foreach>
|
||||
SELECT * FROM dual
|
||||
</insert>
|
||||
@ -279,7 +279,7 @@
|
||||
</select>
|
||||
|
||||
<select id="getRelByDelivery" resultType="com.cim.idm.model.po.delivery.MaterialDeliveryReceive">
|
||||
SELECT md.DELIVERYNAME, md.DELIVERYNUM, md.RECEIVEREQUESTNAME, md.MATERIALSPECNAME
|
||||
SELECT md.DELIVERYNAME, md.DELIVERYNUM, md.RECEIVEREQUESTNAME, md.MATERIALSPECNAME, md.RECEIVEREQUESTDETAILNAME
|
||||
FROM MATERIALDELIVERYRECEIVE md
|
||||
WHERE md.DELIVERYNAME = #{dto.documentName}
|
||||
</select>
|
||||
@ -296,14 +296,28 @@
|
||||
AND m.RECEIVEREQUESTNAME = md.RECEIVEREQUESTNAME
|
||||
</select>
|
||||
|
||||
<select id="getReceiveByMaterialSpec" resultType="com.cim.idm.model.vo.DeliveryReceiveDetailVo">
|
||||
SELECT receiveRequestName, receiveRequestDetailName
|
||||
FROM MATERIALRECEIVEREQUESTDETAIL
|
||||
WHERE RECEIVEREQUESTNAME = #{documentName}
|
||||
AND MATERIALSPECNAME = #{materialSpec}
|
||||
</select>
|
||||
|
||||
<select id="getDeliveryByMaterialSpec" resultType="com.cim.idm.model.vo.DeliveryReceiveDetailVo">
|
||||
SELECT receiveRequestName, receiveRequestDetailName
|
||||
FROM MATERIALDELIVERYRECEIVE
|
||||
WHERE DELIVERYNAME = #{documentName}
|
||||
AND MATERIALSPECNAME = #{materialSpec}
|
||||
</select>
|
||||
|
||||
<select id="getReceiveDetail" resultType="com.cim.idm.model.vo.DeliveryReceiveDetailVo">
|
||||
SELECT receiveRequestName, materialSpecName, requestQuantity, requestQuantity as deliveryNum
|
||||
SELECT receiveRequestName, materialSpecName, requestQuantity, requestQuantity as deliveryNum, RECEIVEREQUESTDETAILNAME
|
||||
FROM MATERIALRECEIVEREQUESTDETAIL
|
||||
WHERE RECEIVEREQUESTNAME in
|
||||
<foreach item="name" index="index" collection="nameList" open="(" separator="," close=")">
|
||||
#{name}
|
||||
</foreach>
|
||||
order by RECEIVEREQUESTNAME
|
||||
order by RECEIVEREQUESTDETAILNAME
|
||||
</select>
|
||||
|
||||
<select id="getDeliveryList" resultType="com.cim.idm.model.po.delivery.MaterialDelivery">
|
||||
|
Loading…
x
Reference in New Issue
Block a user