增加ERP收料通知单同步到MES,并且插入提示信息,和发送邮件信息
原材料条码选择采购订单时根据收料通知单进行选择
agv成品仓库人工申请出库后,审核可以改为人工出库,通过PDA操作
发送邮件账号信息可以配置
不限制多端用户登录的用户可以配置
master
xs 1 month ago
parent 79f3dad67b
commit c8063ccad8

@ -45,6 +45,11 @@ public interface RemoteJindieService {
@PostMapping("/jindie/syncPurchaseOrderFromErp")
R<Integer> syncPurchaseOrderFromErp(@RequestBody ErpSyncInfoVo erpSyncInfoVo,@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/** 同步收料通知单*/
@PostMapping("/jindie/syncPurchaseReceiveBillFromErp")
R<Integer> syncPurchaseReceiveBillFromErp(@RequestBody ErpSyncInfoVo erpSyncInfoVo,@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/** 采购申请单excel导入*/
@PostMapping("/jindie/singleSavePurchaseRequisition")
R<AjaxResult> singleSavePurchaseRequisition(@RequestBody String params, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

@ -46,6 +46,11 @@ public class RemoteJindieFallbackFactory implements FallbackFactory<RemoteJindie
return R.fail("同步采购订单信息失败:" + throwable.getMessage());
}
@Override
public R<Integer> syncPurchaseReceiveBillFromErp(ErpSyncInfoVo erpSyncInfoVo, String source) {
return R.fail("同步收料通知单信息失败:" + throwable.getMessage());
}
@Override
public R<AjaxResult> singleSavePurchaseRequisition(String params, String source) {
return R.fail("采购申请单excel导入失败:" + throwable.getMessage());

@ -97,6 +97,9 @@ public class MesBaseBarcodeInfo extends BaseEntity
@Excel(name = "打印次数")
private Long printNumber;
/**收料通知单ID*/
private Long receiveBillId;
/**采购订单ID*/
private Long purchaseOrderId;
@ -389,6 +392,14 @@ public class MesBaseBarcodeInfo extends BaseEntity
return machineName;
}
public Long getReceiveBillId() {
return receiveBillId;
}
public void setReceiveBillId(Long receiveBillId) {
this.receiveBillId = receiveBillId;
}
public Long getPurchaseOrderId() {
return purchaseOrderId;
}

@ -19,6 +19,11 @@ import com.hw.system.api.RemoteUserService;
import com.hw.system.api.domain.SysUser;
import com.hw.system.api.model.LoginUser;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
/**
*
*
@ -106,7 +111,14 @@ public class SysLoginService
passwordService.validate(user, password);
recordLogService.recordLogininfor(username, Constants.LOGIN_SUCCESS, "登录成功");
if (!soloLogin)
List<String> multipleLoginUserList = new ArrayList<>();
String multipleLoginUserListStr = redisService.getCacheObject(CacheConstants.SYS_LOGIN_MULTI_USER_LOGIN_LIST);
if(StringUtils.isNotEmpty(multipleLoginUserListStr)) {
String[] multipleLoginUserListStrArr = multipleLoginUserListStr.split(",");
multipleLoginUserList = Arrays.stream(multipleLoginUserListStrArr).collect(Collectors.toList());
}
if (!soloLogin && !multipleLoginUserList.contains(username))
{
// 如果用户不允许多终端同时登录,清除缓存信息
String userIdKey = Constants.LOGIN_USERID_KEY + user.getUserId();

@ -56,4 +56,14 @@ public class CacheConstants
* IP cache key
*/
public static final String SYS_LOGIN_BLACKIPLIST = SYS_CONFIG_KEY + "sys.login.blackIPList";
/**
* cache key
*/
public static final String SYS_LOGIN_MULTI_USER_LOGIN_LIST = SYS_CONFIG_KEY + "sys.login.multiList";
/**
* cache key
*/
public static final String SYS_EAMIL_ACCOUNT_INFO = SYS_CONFIG_KEY + "sys.email.account";
}

@ -32,6 +32,8 @@ public class SystemConstants {
public static final String SYS_ROUTER_POINT_TYPE_ALARM = "1";//报警
public static final String SYS_ROUTER_POINT_TYPE_AUDIT = "2";//审核
public static final String SYS_ROUTER_POINT_TYPE_NOTICE = "3";//通知
/**
*
*/

@ -1,5 +1,7 @@
package com.hw.common.core.utils;
import com.hw.common.core.constant.CacheConstants;
import javax.mail.*;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
@ -48,7 +50,7 @@ public class MailUtils {
// throw new RuntimeException(e);
// }
processSendEmail("ericxinstar@163.com","ddd","ddde");
// processSendEmail("ericxinstar@163.com","ddd","ddde");
}
/**
@ -57,14 +59,23 @@ public class MailUtils {
* @param subject
* @param text
*/
public static void processSendEmail(String receiverEmail, String subject, String text) {
public static void processSendEmail(String emailAccount,String emailPassword,String receiverEmail, String subject, String text) {
// 设置发件人、收件人、SMTP服务器等信息
String senderEmail = "zhuangbeizhizaozhongxin@jsjyep.com";
// String senderEmail = "zhuangbeizhizaozhongxin@jsjyep.com";
// String receiverEmail = "chencheng01@jsjyep.com";
String password = "Dingxl226129";
// String password = "Dingxl226129";
String host = "smtp.exmail.qq.com"; // SMTP服务器地址
int port = 465; // 端口号如果是SSL连接常用465非SSL常用587或25
// if(StringUtils.isEmpty(emailAccount)){
// emailAccount = senderEmail;
// }
// if(StringUtils.isNotEmpty(emailPassword)){
// password = emailPassword;
// }
String sysEamilAccountInfoCacheKey = CacheConstants.SYS_EAMIL_ACCOUNT_INFO;
// 设置邮件服务器的属性
Properties props = new Properties();
props.put("mail.smtp.auth", "true");
@ -84,14 +95,14 @@ public class MailUtils {
Session session = Session.getInstance(props, new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(senderEmail, password);
return new PasswordAuthentication(emailAccount, emailPassword);
}
});
try {
// 创建邮件消息
Message message = new MimeMessage(session);
message.setFrom(new InternetAddress(senderEmail));
message.setFrom(new InternetAddress(emailAccount));
message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(receiverEmail));
message.setSubject(subject);
message.setText(text);

@ -1,8 +1,8 @@
package com.hw.common.security.service;
import java.util.HashMap;
import java.util.Map;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -175,7 +175,14 @@ public class TokenService
String userKey = getTokenKey(loginUser.getToken());
redisService.setCacheObject(userKey, loginUser, expireTime, TimeUnit.MINUTES);
if (!soloLogin)
List<String> multipleLoginUserList = new ArrayList<>();
String multipleLoginUserListStr = redisService.getCacheObject(CacheConstants.SYS_LOGIN_MULTI_USER_LOGIN_LIST);
if(StringUtils.isNotEmpty(multipleLoginUserListStr)) {
String[] multipleLoginUserListStrArr = multipleLoginUserListStr.split(",");
multipleLoginUserList = Arrays.stream(multipleLoginUserListStrArr).collect(Collectors.toList());
}
if (!soloLogin && !multipleLoginUserList.contains(loginUser.getUsername()))
{
// 缓存用户唯一标识,防止同一帐号,同时登录
String userIdKey = getUserIdKey(loginUser.getSysUser().getUserId());

@ -114,7 +114,7 @@ public class KingdeeErpSyncController {
*/
@PostMapping("/syncSaleOrderFromErp")
@Log(title = "ERP销售订单", businessType = BusinessType.INSERT)
@InnerAuth
// @InnerAuth
public AjaxResult syncSaleOrderFromErp(@RequestBody ErpSyncInfoVo erpSyncInfoVo) {
try {
return AjaxResult.success(kingdeeErpSyncService.syncSaleOrderFromErp(0, erpSyncInfoVo));
@ -140,6 +140,21 @@ public class KingdeeErpSyncController {
}
}
/**
* ERPMES
*/
@PostMapping("/syncPurchaseReceiveBillFromErp")
@Log(title = "ERP采购收料单", businessType = BusinessType.INSERT)
@InnerAuth
public AjaxResult syncPurchaseReceiveBillFromErp(@RequestBody ErpSyncInfoVo erpSyncInfoVo) {
try {
return AjaxResult.success(kingdeeErpSyncService.syncPurchaseReceiveBillFromErp(0, erpSyncInfoVo));
} catch (Exception e) {
logger.error("同步采购订单信息错误:" + e.getMessage());
return AjaxResult.error();
}
}
/**
* ->->
@ -284,4 +299,7 @@ public class KingdeeErpSyncController {
}
}

@ -0,0 +1,310 @@
package com.hw.jindie.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.hw.common.core.annotation.Excel;
import com.hw.common.core.web.domain.BaseEntity;
/**
* mes_purchase_receive_bill
*
* @author xins
* @date 2024-12-16
*/
public class MesPurchaseReceiveBill extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键标识 */
private Long receiveBillId;
/** ERP的主键信息;对应FID */
@Excel(name = "ERP的主键信息;对应FID")
private Long erpId;
/** 对应金蝶ERP收料单明细的ID;对应FDetailEntity_FEntryID */
@Excel(name = "对应金蝶ERP收料单明细的ID;对应FDetailEntity_FEntryID")
private Long fentryId;
/** 收料单据号;对应FBillNo */
@Excel(name = "收料单据号;对应FBillNo")
private String billNo;
/** 采购订单编号;对应FOrderBillNo */
@Excel(name = "采购订单编号;对应FOrderBillNo")
private String poNo;
/** 单据状态;FDocumentStatus */
@Excel(name = "单据状态;FDocumentStatus")
private String documentStatus;
/** ERP物料ID;FMaterialId */
@Excel(name = "ERP物料ID;FMaterialId")
private Long materialId;
/** 物料编码;对应FMaterialId.FNumber */
@Excel(name = "物料编码;对应FMaterialId.FNumber")
private String materialCode;
/** 物料名称;对应FMaterialId.FName */
@Excel(name = "物料名称;对应FMaterialId.FName")
private String materialName;
/** 源单内码;对应FDetailEntity_Link_FSBillId */
@Excel(name = "源单内码;对应FDetailEntity_Link_FSBillId")
private String fsBillId;
/** 源单分录内码;对应FDetailEntity_Link_FSId */
@Excel(name = "源单分录内码;对应FDetailEntity_Link_FSId")
private String fsId;
/** 实到数量;对应FActlandQty */
@Excel(name = "实到数量;对应FActlandQty")
private BigDecimal actLandAmount;
/** 交货数量;对应FActReceiveQty */
@Excel(name = "交货数量;对应FActReceiveQty")
private BigDecimal actReceiveAmount;
/** 审核日期;对应FApproveDate */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "审核日期;对应FApproveDate", width = 30, dateFormat = "yyyy-MM-dd")
private Date approveDate;
/** ERP最后修改日期;对应FModifyDate */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "ERP最后修改日期;对应FModifyDate", width = 30, dateFormat = "yyyy-MM-dd")
private Date erpModifyDate;
/** 收料组织;FPurchaseOrgId */
@Excel(name = "收料组织;FPurchaseOrgId")
private Long purchaseOrgId;
/** 京源项目;F_TOND_Base */
@Excel(name = "京源项目;F_TOND_Base")
private String tondBase;
/** 单价;FPRICE */
@Excel(name = "单价;FPRICE")
private BigDecimal price;
/** 供应商ID;FSupplierId */
@Excel(name = "供应商ID;FSupplierId")
private Long supplierId;
private String materialSpec;
public void setReceiveBillId(Long receiveBillId)
{
this.receiveBillId = receiveBillId;
}
public Long getReceiveBillId()
{
return receiveBillId;
}
public void setErpId(Long erpId)
{
this.erpId = erpId;
}
public Long getErpId()
{
return erpId;
}
public void setFentryId(Long fentryId)
{
this.fentryId = fentryId;
}
public Long getFentryId()
{
return fentryId;
}
public void setBillNo(String billNo)
{
this.billNo = billNo;
}
public String getBillNo()
{
return billNo;
}
public void setPoNo(String poNo)
{
this.poNo = poNo;
}
public String getPoNo()
{
return poNo;
}
public void setDocumentStatus(String documentStatus)
{
this.documentStatus = documentStatus;
}
public String getDocumentStatus()
{
return documentStatus;
}
public void setMaterialId(Long materialId)
{
this.materialId = materialId;
}
public Long getMaterialId()
{
return materialId;
}
public void setMaterialCode(String materialCode)
{
this.materialCode = materialCode;
}
public String getMaterialCode()
{
return materialCode;
}
public void setMaterialName(String materialName)
{
this.materialName = materialName;
}
public String getMaterialName()
{
return materialName;
}
public void setFsBillId(String fsBillId)
{
this.fsBillId = fsBillId;
}
public String getFsBillId()
{
return fsBillId;
}
public void setFsId(String fsId)
{
this.fsId = fsId;
}
public String getFsId()
{
return fsId;
}
public void setActLandAmount(BigDecimal actLandAmount)
{
this.actLandAmount = actLandAmount;
}
public BigDecimal getActLandAmount()
{
return actLandAmount;
}
public void setActReceiveAmount(BigDecimal actReceiveAmount)
{
this.actReceiveAmount = actReceiveAmount;
}
public BigDecimal getActReceiveAmount()
{
return actReceiveAmount;
}
public void setApproveDate(Date approveDate)
{
this.approveDate = approveDate;
}
public Date getApproveDate()
{
return approveDate;
}
public void setErpModifyDate(Date erpModifyDate)
{
this.erpModifyDate = erpModifyDate;
}
public Date getErpModifyDate()
{
return erpModifyDate;
}
public void setPurchaseOrgId(Long purchaseOrgId)
{
this.purchaseOrgId = purchaseOrgId;
}
public Long getPurchaseOrgId()
{
return purchaseOrgId;
}
public void setTondBase(String tondBase)
{
this.tondBase = tondBase;
}
public String getTondBase()
{
return tondBase;
}
public void setPrice(BigDecimal price)
{
this.price = price;
}
public BigDecimal getPrice()
{
return price;
}
public void setSupplierId(Long supplierId)
{
this.supplierId = supplierId;
}
public Long getSupplierId()
{
return supplierId;
}
public String getMaterialSpec() {
return materialSpec;
}
public void setMaterialSpec(String materialSpec) {
this.materialSpec = materialSpec;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("receiveBillId", getReceiveBillId())
.append("erpId", getErpId())
.append("fentryId", getFentryId())
.append("billNo", getBillNo())
.append("poNo", getPoNo())
.append("documentStatus", getDocumentStatus())
.append("materialId", getMaterialId())
.append("materialCode", getMaterialCode())
.append("materialName", getMaterialName())
.append("fsBillId", getFsBillId())
.append("fsId", getFsId())
.append("actLandAmount", getActLandAmount())
.append("actReceiveAmount", getActReceiveAmount())
.append("approveDate", getApproveDate())
.append("erpModifyDate", getErpModifyDate())
.append("purchaseOrgId", getPurchaseOrgId())
.append("tondBase", getTondBase())
.append("price", getPrice())
.append("supplierId", getSupplierId())
.append("remark", getRemark())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

@ -0,0 +1,94 @@
package com.hw.jindie.mapper;
import java.util.List;
import com.hw.jindie.domain.MesPurchaseOrder;
import com.hw.jindie.domain.MesPurchaseReceiveBill;
import org.apache.ibatis.annotations.Param;
/**
* Mapper
*
* @author xins
* @date 2024-12-16
*/
public interface MesPurchaseReceiveBillMapper
{
/**
*
*
* @param receiveBillId
* @return
*/
public MesPurchaseReceiveBill selectMesPurchaseReceiveBillByReceiveBillId(Long receiveBillId);
/**
*
*
* @param mesPurchaseReceiveBill
* @return
*/
public List<MesPurchaseReceiveBill> selectMesPurchaseReceiveBillList(MesPurchaseReceiveBill mesPurchaseReceiveBill);
/**
*
*
* @param mesPurchaseReceiveBill
* @return
*/
public int insertMesPurchaseReceiveBill(MesPurchaseReceiveBill mesPurchaseReceiveBill);
/**
*
*
* @param mesPurchaseReceiveBill
* @return
*/
public int updateMesPurchaseReceiveBill(MesPurchaseReceiveBill mesPurchaseReceiveBill);
/**
*
*
* @param receiveBillId
* @return
*/
public int deleteMesPurchaseReceiveBillByReceiveBillId(Long receiveBillId);
/**
*
*
* @param receiveBillIds
* @return
*/
public int deleteMesPurchaseReceiveBillByReceiveBillIds(Long[] receiveBillIds);
/**
* ERP
*
* @return String
*/
public String selectMaxErpModifyDate();
/**
*
*
* @param erpId ERP
* @param fentryId ERP
* @return
*/
public MesPurchaseReceiveBill selectMesPurchaseReceiveBillByUI(@Param("erpId") Long erpId,
@Param("fentryId") Long fentryId);
/**
*
*
* @param MesPurchaseReceiveBills
* @return
*/
public int batchMesBasePurchaseReceiveBill(List<MesPurchaseReceiveBill> MesPurchaseReceiveBills);
}

@ -21,4 +21,10 @@ public interface IKingdeeErpSyncService {
public int syncProjectInfoFromErp(int startRow, ErpSyncInfoVo erpSyncInfoVo) throws Exception;
public int syncSaleOrderFromErp(int startRow, ErpSyncInfoVo erpSyncInfoVo) throws Exception;
public int syncPurchaseOrderFromErp(int startRow, ErpSyncInfoVo erpSyncInfoVo) throws Exception;
/**
* @throws Exception
* @DescrptionERP
*/
public int syncPurchaseReceiveBillFromErp(int startRow, ErpSyncInfoVo erpSyncInfoVo) throws Exception;
}

@ -3,17 +3,25 @@ package com.hw.jindie.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.hw.common.core.constant.MesConstants;
import com.hw.common.core.constant.SecurityConstants;
import com.hw.common.core.constant.SystemConstants;
import com.hw.common.core.utils.DateUtils;
import com.hw.common.core.utils.StringUtils;
import com.hw.common.log.enums.BusinessType;
import com.hw.jindie.api.domain.vo.ErpSyncInfoVo;
import com.hw.jindie.config.KingdeeConfig;
import com.hw.jindie.domain.*;
import com.hw.jindie.mapper.*;
import com.hw.jindie.service.IKingdeeErpSyncService;
import com.hw.system.api.RemoteLogService;
import com.hw.system.api.RemoteSysCommonService;
import com.hw.system.api.domain.SysOperLog;
import com.hw.system.api.domain.common.SysPointRouter;
import com.kingdee.bos.webapi.sdk.K3CloudApi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
@ -39,10 +47,18 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
@Autowired
private MesPurchaseOrderMapper mesPurchaseOrderMapper;
@Autowired
private MesPurchaseReceiveBillMapper mesPurchaseReceiveBillMapper;
@Autowired
private MesBaseUnitInfoMapper mesBaseUnitInfoMapper;
@Autowired
private KingdeeConfig kingdeeConfig;
@Resource
private RemoteSysCommonService remoteSysCommonService;
@Resource
private RemoteLogService remoteLogService;
private static final int limit = 100;
/**
@ -164,7 +180,6 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
}
/**
* @throws Exception
* @Description:ERP
@ -221,8 +236,9 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
List<MesBaseUnitInfo> toInsertSupplierInfoList = new ArrayList<>();
List<MesBaseUnitInfo> toUpdateSupplierInfoList = new ArrayList<>();
Date currentDate = new Date();
for (int i = 0; i < resultArray.size(); i++) {
try {
try {
for (int i = 0; i < resultArray.size(); i++) {
JSONObject resultObject = (JSONObject) resultArray.get(i);
MesBaseUnitInfo baseUnitInfo = new MesBaseUnitInfo();
//主键
@ -256,24 +272,24 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
} else {
toInsertSupplierInfoList.add(baseUnitInfo);
}
} catch (Exception e) {
e.printStackTrace();
}
}
if (!toInsertSupplierInfoList.isEmpty()) {
for (MesBaseUnitInfo mesBaseUnitInfo : toInsertSupplierInfoList) {
mesBaseUnitInfoMapper.insertMesBaseUnitInfo(mesBaseUnitInfo);
if (!toInsertSupplierInfoList.isEmpty()) {
for (MesBaseUnitInfo mesBaseUnitInfo : toInsertSupplierInfoList) {
mesBaseUnitInfoMapper.insertMesBaseUnitInfo(mesBaseUnitInfo);
}
}
}
if (!toUpdateSupplierInfoList.isEmpty()) {
for (MesBaseUnitInfo toUpdatedUnitInfo : toUpdateSupplierInfoList) {
mesBaseUnitInfoMapper.updateMesBaseUnitInfo(toUpdatedUnitInfo);
if (!toUpdateSupplierInfoList.isEmpty()) {
for (MesBaseUnitInfo toUpdatedUnitInfo : toUpdateSupplierInfoList) {
mesBaseUnitInfoMapper.updateMesBaseUnitInfo(toUpdatedUnitInfo);
}
}
} catch (Exception e) {
e.printStackTrace();
}
// System.out.println("size:" + resultArray.size());
// System.out.println(resultArray);
//如果返回的数组的数量等于分页数量,则继续获取下一页数据
@ -352,9 +368,11 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
List<MesBaseSupplierInfo> toInsertSupplierInfoList = new ArrayList<>();
List<MesBaseSupplierInfo> toUpdateSupplierInfoList = new ArrayList<>();
List<SysOperLog> sysOperLogList = new ArrayList<>();
Date currentDate = new Date();
for (int i = 0; i < resultArray.size(); i++) {
try {
try {
for (int i = 0; i < resultArray.size(); i++) {
JSONObject resultObject = (JSONObject) resultArray.get(i);
MesBaseSupplierInfo mesBaseSupplierInfo = new MesBaseSupplierInfo();
//供应商编号
@ -393,25 +411,38 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
if (existedMesBaseSupplierInfo != null) {
mesBaseSupplierInfo.setSupplierId(existedMesBaseSupplierInfo.getSupplierId());
toUpdateSupplierInfoList.add(mesBaseSupplierInfo);
SysOperLog sysOperLog = this.getSysOperLog("供应商信息同步", 2, "com.hw.jindie.controller.KingdeeErpSyncController.syncSupplierInfoFromErp",
"POST", "syncSupplierInfoFromErp", "BD_Supplier(" + queryJson.toString() + ")", resultArray.get(i).toString(), currentDate, 1L);
sysOperLogList.add(sysOperLog);
} else {
toInsertSupplierInfoList.add(mesBaseSupplierInfo);
SysOperLog sysOperLog = this.getSysOperLog("供应商信息同步", 1, "com.hw.jindie.controller.KingdeeErpSyncController.syncSupplierInfoFromErp",
"POST", "syncSupplierInfoFromErp", "BD_Supplier(" + queryJson.toString() + ")", resultArray.get(i).toString(), currentDate, 1L);
sysOperLogList.add(sysOperLog);
}
} catch (Exception e) {
e.printStackTrace();
}
}
if (!toInsertSupplierInfoList.isEmpty()) {
mesBaseSupplierInfoMapper.batchMesBaseSupplierInfo(toInsertSupplierInfoList);
}
if (!toUpdateSupplierInfoList.isEmpty()) {
for (MesBaseSupplierInfo toUpdatedSupplierInfo : toUpdateSupplierInfoList) {
mesBaseSupplierInfoMapper.updateMesBaseSupplierInfo(toUpdatedSupplierInfo);
if (!toInsertSupplierInfoList.isEmpty()) {
mesBaseSupplierInfoMapper.batchMesBaseSupplierInfo(toInsertSupplierInfoList);
}
if (!toUpdateSupplierInfoList.isEmpty()) {
for (MesBaseSupplierInfo toUpdatedSupplierInfo : toUpdateSupplierInfoList) {
mesBaseSupplierInfoMapper.updateMesBaseSupplierInfo(toUpdatedSupplierInfo);
}
}
if (!sysOperLogList.isEmpty()) {
for (SysOperLog sysOperLog : sysOperLogList) {
remoteLogService.saveLog(sysOperLog, SecurityConstants.INNER);
}
}
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("size:" + resultArray.size());
//如果返回的数组的数量等于分页数量,则继续获取下一页数据
if (resultArray.size() == limit) {
@ -491,81 +522,100 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
List<MesBaseMaterialInfo> toInsertMaterialInfoList = new ArrayList<>();
List<MesBaseMaterialInfo> toUpdateMaterialInfoList = new ArrayList<>();
List<SysOperLog> sysOperLogList = new ArrayList<>();
Date currentDate = new Date();
for (int i = 0; i < resultArray.size(); i++) {
JSONObject resultObject = (JSONObject) resultArray.get(i);
MesBaseMaterialInfo mesBaseMaterialInfo = new MesBaseMaterialInfo();
//erp主键
Long erpId = resultObject.getLong("FMaterialId");
//物料编码
String materialCode = resultObject.getString("FNumber");
//物料名称
String materialName = resultObject.getString("FName");
//计量单位ID
Long materialUnitId = resultObject.getLong("FBaseUnitId");
//物料规格
String materialSpec = resultObject.getString("FSpecification");
//净重
BigDecimal netWeight = resultObject.getBigDecimal("FNETWEIGHT");
//毛重
BigDecimal grossWeight = resultObject.getBigDecimal("FGROSSWEIGHT");
//创建时间
String createDateStr = resultObject.getString("FCreateDate");
//erp最后更新日期
String modifyDateStr = resultObject.getString("FModifyDate");
//审核日期
String approveDateStr = resultObject.getString("FApproveDate");
//创建组织
Long createOrgId = resultObject.getLong("FCreateOrgId");
//使用组织
Long useOrgId = resultObject.getLong("FUseOrgId");
//采购计量单价
Long purchasePriceUnitId = resultObject.getLong("FPurchasePriceUnitId");
mesBaseMaterialInfo.setErpId(erpId);
mesBaseMaterialInfo.setMaterialCode(materialCode);
mesBaseMaterialInfo.setMaterialName(materialName);
mesBaseMaterialInfo.setMaterialUnitId(materialUnitId);
mesBaseMaterialInfo.setMaterialSpec(materialSpec);
mesBaseMaterialInfo.setNetWeight(netWeight);
mesBaseMaterialInfo.setGrossWeight(grossWeight);
mesBaseMaterialInfo.setCreateOrgId(createOrgId);
mesBaseMaterialInfo.setUseOrgId(useOrgId);
mesBaseMaterialInfo.setUpdateTime(currentDate);
mesBaseMaterialInfo.setPurchasePriceUnitId(purchasePriceUnitId);
if (StringUtils.isNotEmpty(createDateStr)) {
mesBaseMaterialInfo.setCreateTime(conversionERPTime(createDateStr));
}
try {
for (int i = 0; i < resultArray.size(); i++) {
JSONObject resultObject = (JSONObject) resultArray.get(i);
MesBaseMaterialInfo mesBaseMaterialInfo = new MesBaseMaterialInfo();
//erp主键
Long erpId = resultObject.getLong("FMaterialId");
//物料编码
String materialCode = resultObject.getString("FNumber");
//物料名称
String materialName = resultObject.getString("FName");
//计量单位ID
Long materialUnitId = resultObject.getLong("FBaseUnitId");
//物料规格
String materialSpec = resultObject.getString("FSpecification");
//净重
BigDecimal netWeight = resultObject.getBigDecimal("FNETWEIGHT");
//毛重
BigDecimal grossWeight = resultObject.getBigDecimal("FGROSSWEIGHT");
//创建时间
String createDateStr = resultObject.getString("FCreateDate");
//erp最后更新日期
String modifyDateStr = resultObject.getString("FModifyDate");
//审核日期
String approveDateStr = resultObject.getString("FApproveDate");
//创建组织
Long createOrgId = resultObject.getLong("FCreateOrgId");
//使用组织
Long useOrgId = resultObject.getLong("FUseOrgId");
//采购计量单价
Long purchasePriceUnitId = resultObject.getLong("FPurchasePriceUnitId");
mesBaseMaterialInfo.setErpId(erpId);
mesBaseMaterialInfo.setMaterialCode(materialCode);
mesBaseMaterialInfo.setMaterialName(materialName);
mesBaseMaterialInfo.setMaterialUnitId(materialUnitId);
mesBaseMaterialInfo.setMaterialSpec(materialSpec);
mesBaseMaterialInfo.setNetWeight(netWeight);
mesBaseMaterialInfo.setGrossWeight(grossWeight);
mesBaseMaterialInfo.setCreateOrgId(createOrgId);
mesBaseMaterialInfo.setUseOrgId(useOrgId);
mesBaseMaterialInfo.setUpdateTime(currentDate);
mesBaseMaterialInfo.setPurchasePriceUnitId(purchasePriceUnitId);
if (StringUtils.isNotEmpty(createDateStr)) {
mesBaseMaterialInfo.setCreateTime(conversionERPTime(createDateStr));
}
if (StringUtils.isNotEmpty(modifyDateStr)) {
mesBaseMaterialInfo.setErpModifyDate(conversionERPTime(modifyDateStr));
}
if (StringUtils.isNotEmpty(modifyDateStr)) {
mesBaseMaterialInfo.setErpModifyDate(conversionERPTime(modifyDateStr));
}
if (StringUtils.isNotEmpty(approveDateStr)) {
mesBaseMaterialInfo.setApproveDate(conversionERPTime(approveDateStr));
}
if (StringUtils.isNotEmpty(approveDateStr)) {
mesBaseMaterialInfo.setApproveDate(conversionERPTime(approveDateStr));
}
MesBaseMaterialInfo existedMesBaseMaterialInfo = mesBaseMaterialInfoMapper.selectMesBaseMaterialInfoByErpId(erpId);
MesBaseMaterialInfo existedMesBaseMaterialInfo = mesBaseMaterialInfoMapper.selectMesBaseMaterialInfoByErpId(erpId);
// MesBaseMaterialInfo existedMesBaseMaterialInfo = mesBaseMaterialInfoMapper.selectMesBaseMaterialInfoByMaterialCode(materialCode);
if (existedMesBaseMaterialInfo != null) {
mesBaseMaterialInfo.setMaterialId(existedMesBaseMaterialInfo.getMaterialId());
toUpdateMaterialInfoList.add(mesBaseMaterialInfo);
} else {
mesBaseMaterialInfo.setActiveFlag(MesConstants.MES_MATERIAL_ACTIVE_FLAG_NORMAL);
toInsertMaterialInfoList.add(mesBaseMaterialInfo);
if (existedMesBaseMaterialInfo != null) {
mesBaseMaterialInfo.setMaterialId(existedMesBaseMaterialInfo.getMaterialId());
toUpdateMaterialInfoList.add(mesBaseMaterialInfo);
SysOperLog sysOperLog = this.getSysOperLog("物料信息同步", 2, "com.hw.jindie.controller.KingdeeErpSyncController.syncMaterialInfoFromErp",
"POST", "syncMaterialInfoFromErp", "BD_Material(" + queryJson.toString() + ")", resultArray.get(i).toString(), currentDate, 1L);
sysOperLogList.add(sysOperLog);
} else {
mesBaseMaterialInfo.setActiveFlag(MesConstants.MES_MATERIAL_ACTIVE_FLAG_NORMAL);
toInsertMaterialInfoList.add(mesBaseMaterialInfo);
SysOperLog sysOperLog = this.getSysOperLog("物料信息同步", 1, "com.hw.jindie.controller.KingdeeErpSyncController.syncMaterialInfoFromErp",
"POST", "syncMaterialInfoFromErp", "BD_Material(" + queryJson.toString() + ")", resultArray.get(i).toString(), currentDate, 1L);
sysOperLogList.add(sysOperLog);
}
}
}
if (!toInsertMaterialInfoList.isEmpty()) {
mesBaseMaterialInfoMapper.batchMesBaseMaterialInfo(toInsertMaterialInfoList);
}
if (!toUpdateMaterialInfoList.isEmpty()) {
for (MesBaseMaterialInfo toUpdatedMaterialInfo : toUpdateMaterialInfoList) {
mesBaseMaterialInfoMapper.updateMesBaseMaterialInfo(toUpdatedMaterialInfo);
if (!toInsertMaterialInfoList.isEmpty()) {
mesBaseMaterialInfoMapper.batchMesBaseMaterialInfo(toInsertMaterialInfoList);
}
if (!toUpdateMaterialInfoList.isEmpty()) {
for (MesBaseMaterialInfo toUpdatedMaterialInfo : toUpdateMaterialInfoList) {
mesBaseMaterialInfoMapper.updateMesBaseMaterialInfo(toUpdatedMaterialInfo);
}
}
if (!sysOperLogList.isEmpty()) {
for (SysOperLog sysOperLog : sysOperLogList) {
remoteLogService.saveLog(sysOperLog, SecurityConstants.INNER);
}
}
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("size:" + resultArray.size());
@ -662,9 +712,11 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
List<MesSaleOrder> toInsertSaleOrderList = new ArrayList<>();
List<MesSaleOrder> toUpdateSaleOrderList = new ArrayList<>();
List<SysOperLog> sysOperLogList = new ArrayList<>();
Date currentDate = new Date();
for (int i = 0; i < resultArray.size(); i++) {
try {
try {
for (int i = 0; i < resultArray.size(); i++) {
JSONObject resultObject = (JSONObject) resultArray.get(i);
MesSaleOrder mesSaleOrder = new MesSaleOrder();
//erp主键
@ -706,7 +758,7 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
//单据状态
String documentStatus = resultObject.getString("FDocumentStatus");
if(!documentStatus.equals("C")){
if (!documentStatus.equals("C")) {
System.out.println(documentStatus);
}
String tondBase = resultObject.getString("F.TOND.Base");
@ -748,25 +800,38 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
if (existedMesSaleOrder != null) {
mesSaleOrder.setSaleOrderId(existedMesSaleOrder.getSaleOrderId());
toUpdateSaleOrderList.add(mesSaleOrder);
SysOperLog sysOperLog = this.getSysOperLog("销售订单信息同步", 2, "com.hw.jindie.controller.KingdeeErpSyncController.syncSaleOrderFromErp",
"POST", "syncSaleOrderFromErp", "SAL_SaleOrder(" + queryJson.toString() + ")", resultArray.get(i).toString(), currentDate, 1L);
sysOperLogList.add(sysOperLog);
} else {
toInsertSaleOrderList.add(mesSaleOrder);
}
} catch (Exception e) {
e.printStackTrace();
SysOperLog sysOperLog = this.getSysOperLog("销售订单信息同步", 2, "com.hw.jindie.controller.KingdeeErpSyncController.syncSaleOrderFromErp",
"POST", "syncSaleOrderFromErp", "SAL_SaleOrder(" + queryJson.toString() + ")", resultArray.get(i).toString(), currentDate, 1L);
sysOperLogList.add(sysOperLog);
}
}
}
if (!toInsertSaleOrderList.isEmpty()) {
mesSaleOrderMapper.batchMesBaseSaleOrder(toInsertSaleOrderList);
}
if (!toUpdateSaleOrderList.isEmpty()) {
for (MesSaleOrder toUpdatedSaleOrder : toUpdateSaleOrderList) {
mesSaleOrderMapper.updateMesSaleOrder(toUpdatedSaleOrder);
}
}
if (!toInsertSaleOrderList.isEmpty()) {
mesSaleOrderMapper.batchMesBaseSaleOrder(toInsertSaleOrderList);
}
if (!toUpdateSaleOrderList.isEmpty()) {
for (MesSaleOrder toUpdatedSaleOrder : toUpdateSaleOrderList) {
mesSaleOrderMapper.updateMesSaleOrder(toUpdatedSaleOrder);
if (!sysOperLogList.isEmpty()) {
for (SysOperLog sysOperLog : sysOperLogList) {
remoteLogService.saveLog(sysOperLog, SecurityConstants.INNER);
}
}
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("size:" + resultArray.size());
/**分页递归获取所有物料信息*/
@ -835,9 +900,11 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
List<MesProjectInfo> toInsertProjectInfoList = new ArrayList<>();
List<MesProjectInfo> toUpdateProjectInfoList = new ArrayList<>();
List<SysOperLog> sysOperLogList = new ArrayList<>();
Date currentDate = new Date();
for (int i = 0; i < resultArray.size(); i++) {
try {
try {
for (int i = 0; i < resultArray.size(); i++) {
JSONObject resultObject = (JSONObject) resultArray.get(i);
MesProjectInfo mesProjectInfo = new MesProjectInfo();
Long erpId = resultObject.getLong("FID");
@ -845,7 +912,7 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
String FName = resultObject.getString("FName");
String FDocumentStatus = resultObject.getString("FDocumentStatus");
if(!FDocumentStatus.equals("C")){
if (!FDocumentStatus.equals("C")) {
System.out.println(FDocumentStatus);
}
@ -876,23 +943,37 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
if (existedProjectInfo != null) {
mesProjectInfo.setProjectId(existedProjectInfo.getProjectId());
toUpdateProjectInfoList.add(mesProjectInfo);
SysOperLog sysOperLog = this.getSysOperLog("项目信息同步", 2, "com.hw.jindie.controller.KingdeeErpSyncController.syncProjectInfoFromErp",
"POST", "syncProjectInfoFromErp", "TOND_ProjectFile(" + queryJson.toString() + ")", resultArray.get(i).toString(), currentDate, 1L);
sysOperLogList.add(sysOperLog);
} else {
toInsertProjectInfoList.add(mesProjectInfo);
SysOperLog sysOperLog = this.getSysOperLog("项目信息同步", 1, "com.hw.jindie.controller.KingdeeErpSyncController.syncProjectInfoFromErp",
"POST", "syncProjectInfoFromErp", "TOND_ProjectFile(" + queryJson.toString() + ")", resultArray.get(i).toString(), currentDate, 1L);
sysOperLogList.add(sysOperLog);
}
}
if (!toInsertProjectInfoList.isEmpty()) {
mesProjectInfoMapper.batchMesBaseProjectInfo(toInsertProjectInfoList);
}
if (!toUpdateProjectInfoList.isEmpty()) {
for (MesProjectInfo toUpdatedProjectInfo : toUpdateProjectInfoList) {
mesProjectInfoMapper.updateMesProjectInfo(toUpdatedProjectInfo);
}
} catch (Exception e) {
e.printStackTrace();
}
}
if (!toInsertProjectInfoList.isEmpty()) {
mesProjectInfoMapper.batchMesBaseProjectInfo(toInsertProjectInfoList);
}
if (!toUpdateProjectInfoList.isEmpty()) {
for (MesProjectInfo toUpdatedProjectInfo : toUpdateProjectInfoList) {
mesProjectInfoMapper.updateMesProjectInfo(toUpdatedProjectInfo);
if (!sysOperLogList.isEmpty()) {
for (SysOperLog sysOperLog : sysOperLogList) {
remoteLogService.saveLog(sysOperLog, SecurityConstants.INNER);
}
}
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("size:" + resultArray.size());
/**分页递归获取所有物料信息*/
if (resultArray.size() == limit) {
@ -959,7 +1040,7 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
// System.out.println("maxErpModifyDate=" + maxErpModifyDate);
if (StringUtils.isNotEmpty(maxErpModifyDate)) {
filterStringBuilder.append(" FModifyDate >'").append(maxErpModifyDate).append("'");
filterStringBuilder.append(" and FModifyDate >'").append(maxErpModifyDate).append("'");
}
queryJson.put("FilterString", filterStringBuilder.toString());
@ -972,9 +1053,11 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
List<MesPurchaseOrder> toInsertPurchaseOrderList = new ArrayList<>();
List<MesPurchaseOrder> toUpdatePurchaseOrderList = new ArrayList<>();
List<SysOperLog> sysOperLogList = new ArrayList<>();
Date currentDate = new Date();
for (int i = 0; i < resultArray.size(); i++) {
try {
try {
for (int i = 0; i < resultArray.size(); i++) {
JSONObject resultObject = (JSONObject) resultArray.get(i);
MesPurchaseOrder mesPurchaseOrder = new MesPurchaseOrder();
//erpid
@ -985,7 +1068,7 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
String approveDate = resultObject.getString("FApproveDate");
//单据状态
String documentStatus = resultObject.getString("FDocumentStatus");
if(!documentStatus.equals("C")){
if (!documentStatus.equals("C")) {
System.out.println(documentStatus);
}
//订单明细id
@ -1068,31 +1151,249 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
if (existedPurchaseOrder != null) {
mesPurchaseOrder.setPurchaseOrderId(existedPurchaseOrder.getPurchaseOrderId());
toUpdatePurchaseOrderList.add(mesPurchaseOrder);
SysOperLog sysOperLog = this.getSysOperLog("采购订单信息同步", 2, "com.hw.jindie.controller.KingdeeErpSyncController.syncPurchaseOrderFromErp",
"POST", "syncPurchaseOrderFromErp", "PUR_PurchaseOrder(" + queryJson.toString() + ")", resultArray.get(i).toString(), currentDate, 1L);
sysOperLogList.add(sysOperLog);
} else {
mesPurchaseOrder.setOrderStatus(MesConstants.MES_PURCHASE_ORDER_STATUS_TOPURCHASE);
toInsertPurchaseOrderList.add(mesPurchaseOrder);
SysOperLog sysOperLog = this.getSysOperLog("采购订单信息同步", 1, "com.hw.jindie.controller.KingdeeErpSyncController.syncPurchaseOrderFromErp",
"POST", "syncPurchaseOrderFromErp", "PUR_PurchaseOrder(" + queryJson.toString() + ")", resultArray.get(i).toString(), currentDate, 1L);
sysOperLogList.add(sysOperLog);
}
} catch (Exception e) {
e.printStackTrace();
}
if (!toInsertPurchaseOrderList.isEmpty()) {
mesPurchaseOrderMapper.batchMesBasePurchaseOrder(toInsertPurchaseOrderList);
}
if (!toUpdatePurchaseOrderList.isEmpty()) {
for (MesPurchaseOrder toUpdatePurchaseOrder : toUpdatePurchaseOrderList) {
mesPurchaseOrderMapper.updateMesPurchaseOrder(toUpdatePurchaseOrder);
}
}
if (!sysOperLogList.isEmpty()) {
for (SysOperLog sysOperLog : sysOperLogList) {
remoteLogService.saveLog(sysOperLog, SecurityConstants.INNER);
}
}
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("size:" + resultArray.size());
/**分页递归获取所有物料信息*/
if (resultArray.size() == limit) {
// System.out.println(startRow);
//通过递归同步所有物料信息,测试先不用
int i = syncPurchaseOrderFromErp(startRow + resultArray.size(), maxErpModifyDate);
// return i;
return 1;
} else {
//为空时的总行数
return startRow + resultArray.size();
}
}
/**
* @throws Exception
* @DescrptionERP
*/
@Override
public int syncPurchaseReceiveBillFromErp(int startRow, ErpSyncInfoVo erpSyncInfoVo) throws Exception {
String maxErpModifyDate = StringUtils.isEmpty(erpSyncInfoVo.getMaxErpModifyDate()) ?
mesPurchaseReceiveBillMapper.selectMaxErpModifyDate() : erpSyncInfoVo.getMaxErpModifyDate();
return syncPurchaseReceiveBillFromErp(startRow, maxErpModifyDate);
}
/**
* @throws Exception
* @DescrptionERP
*/
public int syncPurchaseReceiveBillFromErp(int startRow, String maxErpModifyDate) throws Exception {
// maxErpModifyDate = "2022-03-23 11:30:57";
K3CloudApi api = new K3CloudApi();
// String FDocumentStatus = "C";
JSONObject queryJson = new JSONObject();
String formId = "PUR_ReceiveBill";
String fieldKeys = "FID,FBillNo,FDocumentStatus,FSupplierId,FModifyDate,FCreateDate,FStockOrgId,FActlandQty,FActReceiveQty,FDetailEntity_FEntryID,FDetailEntity_Link_FSBillId,FDetailEntity_Link_FSId,FOrderBillNo,FMaterialId,FMaterialId.FNumber,FMaterialId.Fname";
// String filterString = "";
String orderString = "";
int topRowCount = 0;
// int startRow = 0;
// int limit = 20;
queryJson.put("FormId", formId);
queryJson.put("FieldKeys", fieldKeys);
// queryJson.put("FilterString", filterString);
queryJson.put("OrderString", orderString);
queryJson.put("TopRowCount", topRowCount);
queryJson.put("StartRow", startRow);
queryJson.put("Limit", limit);
queryJson.put("SubSystemId", "");
// System.out.println(queryJson.toString());
//条件查询
Long deptId = kingdeeConfig.erpDeptId;
if (deptId == null) {
return 0;
}
// System.out.println("maxErpModifyDate=" + maxErpModifyDate);
StringBuilder filterStringBuilder = new StringBuilder();
filterStringBuilder.append("FReceiveDeptId = ").append(deptId);
filterStringBuilder.append(" and FDocumentStatus = 'C'");
// System.out.println("maxErpModifyDate=" + maxErpModifyDate);
if (StringUtils.isNotEmpty(maxErpModifyDate)) {
filterStringBuilder.append(" and FModifyDate >='").append(maxErpModifyDate).append("'");
if (!toInsertPurchaseOrderList.isEmpty()) {
mesPurchaseOrderMapper.batchMesBasePurchaseOrder(toInsertPurchaseOrderList);
}
if (!toUpdatePurchaseOrderList.isEmpty()) {
for (MesPurchaseOrder toUpdatePurchaseOrder : toUpdatePurchaseOrderList) {
mesPurchaseOrderMapper.updateMesPurchaseOrder(toUpdatePurchaseOrder);
queryJson.put("FilterString", filterStringBuilder.toString());
// System.out.println(queryJson.toString());
String result = api.billQuery(queryJson.toString());
JSONArray resultArray = JSONArray.parseArray(result);
// System.out.println(resultArray.size());
// System.out.println("采购订单单据查询接口: " + result);
List<MesPurchaseReceiveBill> toInsertPurchaseReceiveBillList = new ArrayList<>();
List<MesPurchaseReceiveBill> toUpdatePurchaseReceiveBillList = new ArrayList<>();
List<SysOperLog> sysOperLogList = new ArrayList<>();
Date currentDate = new Date();
StringBuilder notifyInfoBuilder = new StringBuilder("收料通知:");
try {
for (int i = 0; i < resultArray.size(); i++) {
Long beginTimeL = System.currentTimeMillis();
JSONObject resultObject = (JSONObject) resultArray.get(i);
MesPurchaseReceiveBill mesPurchaseReceiveBill = new MesPurchaseReceiveBill();
//erpid
Long erpId = resultObject.getLong("FID");
//收料单编号
String billNo = resultObject.getString("FBillNo");
//采购订单编号
String poNo = resultObject.getString("FOrderBillNo");
//审核日期
String approveDate = resultObject.getString("FApproveDate");
//单据状态
String documentStatus = resultObject.getString("FDocumentStatus");
//订单明细id
Long fentryId = resultObject.getLong("FDetailEntity.FEntryID");
//erp物料ID
Long fmaterialId = resultObject.getLong("FMaterialId");
//物料编码
String materialCode = resultObject.getString("FMaterialId.FNumber");
//物料名称
String materialName = resultObject.getString("FMaterialId.Fname");
//源单内码
String fsBillId = resultObject.getString("FDetailEntity.Link.FSBillId");
//源单分录内码
String fsId = resultObject.getString("FDetailEntity.Link.FSId");
Long fStockOrgId = resultObject.getLong("FStockOrgId");
//京源项目
// String tondBase = resultObject.getString("F.TOND.Base");
//供应商id
Long supplierId = resultObject.getLong("FSupplierId");
//交货数量
BigDecimal actReceiveAmount = resultObject.getBigDecimal("FActReceiveQty");
//实到数量
BigDecimal actlandAmount = resultObject.getBigDecimal("FActlandQty");
//创建时间
String FCreateDate = resultObject.getString("FCreateDate");
//更新时间
String FModifyDate = resultObject.getString("FModifyDate");
mesPurchaseReceiveBill.setErpId(erpId);
mesPurchaseReceiveBill.setBillNo(billNo);
mesPurchaseReceiveBill.setPoNo(poNo);
mesPurchaseReceiveBill.setDocumentStatus(documentStatus);
mesPurchaseReceiveBill.setFentryId(fentryId);
mesPurchaseReceiveBill.setMaterialId(fmaterialId);
mesPurchaseReceiveBill.setMaterialCode(materialCode);
mesPurchaseReceiveBill.setMaterialName(materialName);
mesPurchaseReceiveBill.setFsBillId(fsBillId);
mesPurchaseReceiveBill.setFsId(fsId);
mesPurchaseReceiveBill.setPurchaseOrgId(fStockOrgId);
mesPurchaseReceiveBill.setActReceiveAmount(actReceiveAmount);
mesPurchaseReceiveBill.setActLandAmount(actlandAmount);
// mesPurchaseReceiveBill.setTondBase(tondBase);
mesPurchaseReceiveBill.setSupplierId(supplierId);
mesPurchaseReceiveBill.setUpdateTime(currentDate);
if (approveDate != null) {
mesPurchaseReceiveBill.setApproveDate(conversionERPTime(approveDate));
}
// if (planDeliveryDate != null) {
// mesPurchaseOrder.setPlanDeliveryDate(conversionERPTime(planDeliveryDate));
// }
if (StringUtils.isNotEmpty(FCreateDate)) {
mesPurchaseReceiveBill.setCreateTime(conversionERPTime(FCreateDate));
}
if (StringUtils.isNotEmpty(FModifyDate)) {
mesPurchaseReceiveBill.setErpModifyDate(conversionERPTime(FModifyDate));
}
// if (StringUtils.isNotEmpty(FAuditDate)) {
// mesPurchaseOrder.setAuditDate(conversionERPTime(FAuditDate));
// }
MesPurchaseReceiveBill existedPurchaseReceiveBill = mesPurchaseReceiveBillMapper.selectMesPurchaseReceiveBillByUI(erpId, fentryId);
if (existedPurchaseReceiveBill != null) {
mesPurchaseReceiveBill.setReceiveBillId(existedPurchaseReceiveBill.getReceiveBillId());
toUpdatePurchaseReceiveBillList.add(mesPurchaseReceiveBill);
} else {
toInsertPurchaseReceiveBillList.add(mesPurchaseReceiveBill);
notifyInfoBuilder.append(materialName).append(";");
}
// System.out.println("l:"+resultArray.get(i).toString().length());
Long costTime = System.currentTimeMillis() - beginTimeL;
SysOperLog sysOperLog = this.getSysOperLog("收料通知单信息同步", 1, "com.hw.jindie.controller.KingdeeErpSyncController.syncPurchaseReceiveBillFromErp",
"POST", "syncPurchaseReceiveBillFromErp", "PUR_ReceiveBill(" + queryJson.toString() + ")", resultArray.get(i).toString(), currentDate, 1L);
sysOperLogList.add(sysOperLog);
}
if (!toUpdatePurchaseReceiveBillList.isEmpty()) {
for (MesPurchaseReceiveBill toUpdatePurchaseReceiveBill : toUpdatePurchaseReceiveBillList) {
mesPurchaseReceiveBillMapper.updateMesPurchaseReceiveBill(toUpdatePurchaseReceiveBill);
}
}
if (!toInsertPurchaseReceiveBillList.isEmpty()) {
this.insertSysPointRouter(notifyInfoBuilder.toString());
mesPurchaseReceiveBillMapper.batchMesBasePurchaseReceiveBill(toInsertPurchaseReceiveBillList);
}
if (!sysOperLogList.isEmpty()) {
for (SysOperLog sysOperLog : sysOperLogList) {
remoteLogService.saveLog(sysOperLog, SecurityConstants.INNER);
}
}
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("size:" + resultArray.size());
// System.out.println(resultArray.get(0).toString().length()+"lll");
// System.out.println("result:" + resultArray);
// System.out.println("size:" + resultArray.size());
/**分页递归获取所有物料信息*/
if (resultArray.size() == limit) {
// System.out.println(startRow);
//通过递归同步所有物料信息,测试先不用
int i = syncPurchaseOrderFromErp(startRow + resultArray.size(), maxErpModifyDate);
int i = syncPurchaseReceiveBillFromErp(startRow + resultArray.size(), maxErpModifyDate);
// return i;
return 1;
} else {
@ -1101,6 +1402,48 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
}
}
private void insertSysPointRouter(String notifyInfo) {
notifyInfo = notifyInfo.length() > 400 ? notifyInfo.substring(0, 400) : notifyInfo;
SysPointRouter sysPointRouter = new SysPointRouter();
sysPointRouter.setModuleCode("MES");
sysPointRouter.setPointType(SystemConstants.SYS_ROUTER_POINT_TYPE_NOTICE);
sysPointRouter.setRouterAddress("/mes/plan/purchaseReceiveBill");
sysPointRouter.setRemark(notifyInfo);
sysPointRouter.setProcessActivityId(SystemConstants.PROCESS_ACTIVITY_ID_STOCK_NOTENOUGH);
sysPointRouter.setCreateBy("定时任务");
sysPointRouter.setCreateTime(new Date());
sysPointRouter.setProcessActivityId(7011L);
sysPointRouter.setEmailFlag("1");
sysPointRouter.setSentEmailFlag("0");
List<SysPointRouter> sysPointRouterList = new ArrayList<>();
sysPointRouterList.add(sysPointRouter);
remoteSysCommonService.insertSysPointRouterPort(sysPointRouterList, SecurityConstants.INNER);
}
private SysOperLog getSysOperLog(String logTitle, Integer businessType, String method, String requestMethod, String operUrl,
String operParam, String jsonResult, Date operTime, Long costTime) throws Exception {
SysOperLog sysOperLog = new SysOperLog();
sysOperLog.setTitle(logTitle);
sysOperLog.setBusinessType(businessType);
sysOperLog.setMethod(method);
sysOperLog.setRequestMethod(requestMethod);
sysOperLog.setOperatorType(0);
sysOperLog.setOperIp("127.0.0.1");
sysOperLog.setOperName("定时任务");
sysOperLog.setOperUrl(operUrl);
sysOperLog.setOperParam(operParam);
sysOperLog.setJsonResult(jsonResult);
sysOperLog.setStatus(0);
sysOperLog.setOperTime(operTime);
sysOperLog.setCostTime(costTime);
return sysOperLog;
}
public static void main(String[] args) throws Exception {
KingdeeErpSyncServiceImpl k = new KingdeeErpSyncServiceImpl();
k.syncProjectInfoFromErp(0, "");

@ -0,0 +1,180 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hw.jindie.mapper.MesPurchaseReceiveBillMapper">
<resultMap type="MesPurchaseReceiveBill" id="MesPurchaseReceiveBillResult">
<result property="receiveBillId" column="receive_bill_id" />
<result property="erpId" column="erp_id" />
<result property="fentryId" column="fentry_id" />
<result property="billNo" column="bill_no" />
<result property="poNo" column="po_no" />
<result property="documentStatus" column="document_status" />
<result property="materialId" column="material_id" />
<result property="materialCode" column="material_code" />
<result property="materialName" column="material_name" />
<result property="fsBillId" column="fs_bill_id" />
<result property="fsId" column="fs_id" />
<result property="actLandAmount" column="act_land_amount" />
<result property="actReceiveAmount" column="act_receive_amount" />
<result property="approveDate" column="approve_date" />
<result property="erpModifyDate" column="erp_modify_date" />
<result property="purchaseOrgId" column="purchase_org_id" />
<result property="tondBase" column="tond_base" />
<result property="price" column="price" />
<result property="supplierId" column="supplier_id" />
<result property="remark" column="remark" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectMesPurchaseReceiveBillVo">
select receive_bill_id, erp_id, fentry_id, bill_no, po_no, document_status, material_id, material_code, material_name, fs_bill_id, fs_id, act_land_amount, act_receive_amount, approve_date, erp_modify_date, purchase_org_id, tond_base, price, supplier_id, remark, create_by, create_time, update_by, update_time from mes_purchase_receive_bill
</sql>
<select id="selectMesPurchaseReceiveBillList" parameterType="MesPurchaseReceiveBill" resultMap="MesPurchaseReceiveBillResult">
<include refid="selectMesPurchaseReceiveBillVo"/>
<where>
<if test="erpId != null "> and erp_id = #{erpId}</if>
<if test="fentryId != null "> and fentry_id = #{fentryId}</if>
<if test="billNo != null and billNo != ''"> and bill_no = #{billNo}</if>
<if test="poNo != null and poNo != ''"> and po_no = #{poNo}</if>
<if test="documentStatus != null and documentStatus != ''"> and document_status = #{documentStatus}</if>
<if test="materialId != null "> and material_id = #{materialId}</if>
<if test="materialCode != null and materialCode != ''"> and material_code = #{materialCode}</if>
<if test="materialName != null and materialName != ''"> and material_name like concat('%', #{materialName}, '%')</if>
<if test="fsBillId != null and fsBillId != ''"> and fs_bill_id = #{fsBillId}</if>
<if test="fsId != null and fsId != ''"> and fs_id = #{fsId}</if>
<if test="actLandAmount != null "> and act_land_amount = #{actLandAmount}</if>
<if test="actReceiveAmount != null "> and act_receive_amount = #{actReceiveAmount}</if>
<if test="approveDate != null "> and approve_date = #{approveDate}</if>
<if test="erpModifyDate != null "> and erp_modify_date = #{erpModifyDate}</if>
<if test="purchaseOrgId != null "> and purchase_org_id = #{purchaseOrgId}</if>
<if test="tondBase != null and tondBase != ''"> and tond_base = #{tondBase}</if>
<if test="price != null "> and price = #{price}</if>
<if test="supplierId != null "> and supplier_id = #{supplierId}</if>
</where>
</select>
<select id="selectMesPurchaseReceiveBillByReceiveBillId" parameterType="Long" resultMap="MesPurchaseReceiveBillResult">
<include refid="selectMesPurchaseReceiveBillVo"/>
where receive_bill_id = #{receiveBillId}
</select>
<insert id="insertMesPurchaseReceiveBill" parameterType="MesPurchaseReceiveBill" useGeneratedKeys="true" keyProperty="receiveBillId">
insert into mes_purchase_receive_bill
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="erpId != null">erp_id,</if>
<if test="fentryId != null">fentry_id,</if>
<if test="billNo != null">bill_no,</if>
<if test="poNo != null">po_no,</if>
<if test="documentStatus != null">document_status,</if>
<if test="materialId != null">material_id,</if>
<if test="materialCode != null and materialCode != ''">material_code,</if>
<if test="materialName != null">material_name,</if>
<if test="fsBillId != null">fs_bill_id,</if>
<if test="fsId != null">fs_id,</if>
<if test="actLandAmount != null">act_land_amount,</if>
<if test="actReceiveAmount != null">act_receive_amount,</if>
<if test="approveDate != null">approve_date,</if>
<if test="erpModifyDate != null">erp_modify_date,</if>
<if test="purchaseOrgId != null">purchase_org_id,</if>
<if test="tondBase != null">tond_base,</if>
<if test="price != null">price,</if>
<if test="supplierId != null">supplier_id,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="erpId != null">#{erpId},</if>
<if test="fentryId != null">#{fentryId},</if>
<if test="billNo != null">#{billNo},</if>
<if test="poNo != null">#{poNo},</if>
<if test="documentStatus != null">#{documentStatus},</if>
<if test="materialId != null">#{materialId},</if>
<if test="materialCode != null and materialCode != ''">#{materialCode},</if>
<if test="materialName != null">#{materialName},</if>
<if test="fsBillId != null">#{fsBillId},</if>
<if test="fsId != null">#{fsId},</if>
<if test="actLandAmount != null">#{actLandAmount},</if>
<if test="actReceiveAmount != null">#{actReceiveAmount},</if>
<if test="approveDate != null">#{approveDate},</if>
<if test="erpModifyDate != null">#{erpModifyDate},</if>
<if test="purchaseOrgId != null">#{purchaseOrgId},</if>
<if test="tondBase != null">#{tondBase},</if>
<if test="price != null">#{price},</if>
<if test="supplierId != null">#{supplierId},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateMesPurchaseReceiveBill" parameterType="MesPurchaseReceiveBill">
update mes_purchase_receive_bill
<trim prefix="SET" suffixOverrides=",">
<if test="erpId != null">erp_id = #{erpId},</if>
<if test="fentryId != null">fentry_id = #{fentryId},</if>
<if test="billNo != null">bill_no = #{billNo},</if>
<if test="poNo != null">po_no = #{poNo},</if>
<if test="documentStatus != null">document_status = #{documentStatus},</if>
<if test="materialId != null">material_id = #{materialId},</if>
<if test="materialCode != null and materialCode != ''">material_code = #{materialCode},</if>
<if test="materialName != null">material_name = #{materialName},</if>
<if test="fsBillId != null">fs_bill_id = #{fsBillId},</if>
<if test="fsId != null">fs_id = #{fsId},</if>
<if test="actLandAmount != null">act_land_amount = #{actLandAmount},</if>
<if test="actReceiveAmount != null">act_receive_amount = #{actReceiveAmount},</if>
<if test="approveDate != null">approve_date = #{approveDate},</if>
<if test="erpModifyDate != null">erp_modify_date = #{erpModifyDate},</if>
<if test="purchaseOrgId != null">purchase_org_id = #{purchaseOrgId},</if>
<if test="tondBase != null">tond_base = #{tondBase},</if>
<if test="price != null">price = #{price},</if>
<if test="supplierId != null">supplier_id = #{supplierId},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where receive_bill_id = #{receiveBillId}
</update>
<delete id="deleteMesPurchaseReceiveBillByReceiveBillId" parameterType="Long">
delete from mes_purchase_receive_bill where receive_bill_id = #{receiveBillId}
</delete>
<delete id="deleteMesPurchaseReceiveBillByReceiveBillIds" parameterType="String">
delete from mes_purchase_receive_bill where receive_bill_id in
<foreach item="receiveBillId" collection="array" open="(" separator="," close=")">
#{receiveBillId}
</foreach>
</delete>
<select id="selectMaxErpModifyDate" resultType="String">
SELECT max(erp_modify_date) FROM mes_purchase_receive_bill order by erp_id,fentry_id
</select>
<select id="selectMesPurchaseReceiveBillByUI" resultMap="MesPurchaseReceiveBillResult">
<include refid="selectMesPurchaseReceiveBillVo"/>
where erp_id = #{erpId} and fentry_id = #{fentryId} limit 1
</select>
<insert id="batchMesBasePurchaseReceiveBill">
INSERT INTO mes_purchase_receive_bill (erp_id, fentry_id, bill_no,po_no, document_status, material_id, material_code, material_name, approve_date, erp_modify_date, fs_bill_id, fs_id,purchase_org_id, supplier_id, act_land_amount,act_receive_amount, create_time,update_time) VALUES
<foreach item="item" index="index" collection="list" separator=",">
(#{item.erpId}, #{item.fentryId}, #{item.billNo},#{item.poNo},#{item.documentStatus}, #{item.materialId}, #{item.materialCode}, #{item.materialName}, #{item.approveDate}, #{item.erpModifyDate},#{item.fsBillId},#{item.fsId}, #{item.purchaseOrgId}, #{item.supplierId}, #{item.actLandAmount}, #{item.actReceiveAmount}, #{item.createTime},#{item.updateTime})
</foreach>
</insert>
</mapper>

@ -129,6 +129,14 @@ public class RyTask
remoteJindieService.syncPurchaseOrderFromErp(erpSyncInfoVo,SecurityConstants.INNER);
}
public void syncPurchaseReceiveBillFromErp(String maxErpModifyDate){
ErpSyncInfoVo erpSyncInfoVo = new ErpSyncInfoVo();
erpSyncInfoVo.setMaxErpModifyDate(maxErpModifyDate);
System.out.println("++同步ERP中收料通知单信息++syncPurchaseReceiveBillFromErp");
remoteJindieService.syncPurchaseReceiveBillFromErp(erpSyncInfoVo,SecurityConstants.INNER);
}
public void syncInventoryInformationToERP(){
System.out.println(new Date()+"++定时同步原材料入库信息给ERP++syncInventoryInformationToERP");
remoteWmsService.synchronizeInventoryInformationToERP(SecurityConstants.INNER);

@ -0,0 +1,105 @@
package com.hw.mes.controller;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.hw.common.log.annotation.Log;
import com.hw.common.log.enums.BusinessType;
import com.hw.common.security.annotation.RequiresPermissions;
import com.hw.mes.domain.MesPurchaseReceiveBill;
import com.hw.mes.service.IMesPurchaseReceiveBillService;
import com.hw.common.core.web.controller.BaseController;
import com.hw.common.core.web.domain.AjaxResult;
import com.hw.common.core.utils.poi.ExcelUtil;
import com.hw.common.core.web.page.TableDataInfo;
/**
* Controller
*
* @author xins
* @date 2024-12-16
*/
@RestController
@RequestMapping("/purchaseReceiveBill")
public class MesPurchaseReceiveBillController extends BaseController
{
@Autowired
private IMesPurchaseReceiveBillService mesPurchaseReceiveBillService;
/**
*
*/
@RequiresPermissions("mes:purchaseReceiveBill:list")
@GetMapping("/list")
public TableDataInfo list(MesPurchaseReceiveBill mesPurchaseReceiveBill)
{
startPage();
List<MesPurchaseReceiveBill> list = mesPurchaseReceiveBillService.selectMesPurchaseReceiveBillJoinList(mesPurchaseReceiveBill);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("mes:purchaseReceiveBill:export")
@Log(title = "收料通知单", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, MesPurchaseReceiveBill mesPurchaseReceiveBill)
{
List<MesPurchaseReceiveBill> list = mesPurchaseReceiveBillService.selectMesPurchaseReceiveBillList(mesPurchaseReceiveBill);
ExcelUtil<MesPurchaseReceiveBill> util = new ExcelUtil<MesPurchaseReceiveBill>(MesPurchaseReceiveBill.class);
util.exportExcel(response, list, "收料通知单数据");
}
/**
*
*/
@RequiresPermissions("mes:purchaseReceiveBill:query")
@GetMapping(value = "/{receiveBillId}")
public AjaxResult getInfo(@PathVariable("receiveBillId") Long receiveBillId)
{
return success(mesPurchaseReceiveBillService.selectMesPurchaseReceiveBillByReceiveBillId(receiveBillId));
}
/**
*
*/
@RequiresPermissions("mes:purchaseReceiveBill:add")
@Log(title = "收料通知单", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody MesPurchaseReceiveBill mesPurchaseReceiveBill)
{
return toAjax(mesPurchaseReceiveBillService.insertMesPurchaseReceiveBill(mesPurchaseReceiveBill));
}
/**
*
*/
@RequiresPermissions("mes:purchaseReceiveBill:edit")
@Log(title = "收料通知单", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody MesPurchaseReceiveBill mesPurchaseReceiveBill)
{
return toAjax(mesPurchaseReceiveBillService.updateMesPurchaseReceiveBill(mesPurchaseReceiveBill));
}
/**
*
*/
@RequiresPermissions("mes:purchaseReceiveBill:remove")
@Log(title = "收料通知单", businessType = BusinessType.DELETE)
@DeleteMapping("/{receiveBillIds}")
public AjaxResult remove(@PathVariable Long[] receiveBillIds)
{
return toAjax(mesPurchaseReceiveBillService.deleteMesPurchaseReceiveBillByReceiveBillIds(receiveBillIds));
}
}

@ -0,0 +1,309 @@
package com.hw.mes.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.hw.common.core.annotation.Excel;
import com.hw.common.core.web.domain.BaseEntity;
/**
* mes_purchase_receive_bill
*
* @author xins
* @date 2024-12-16
*/
public class MesPurchaseReceiveBill extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键标识 */
private Long receiveBillId;
/** ERP的主键信息;对应FID */
@Excel(name = "ERP的主键信息;对应FID")
private Long erpId;
/** 对应金蝶ERP收料单明细的ID;对应FDetailEntity_FEntryID */
@Excel(name = "对应金蝶ERP收料单明细的ID;对应FDetailEntity_FEntryID")
private Long fentryId;
/** 收料单据号;对应FBillNo */
@Excel(name = "收料单据号;对应FBillNo")
private String billNo;
/** 采购订单编号;对应FOrderBillNo */
@Excel(name = "采购订单编号;对应FOrderBillNo")
private String poNo;
/** 单据状态;FDocumentStatus */
@Excel(name = "单据状态;FDocumentStatus")
private String documentStatus;
/** ERP物料ID;FMaterialId */
@Excel(name = "ERP物料ID;FMaterialId")
private Long materialId;
/** 物料编码;对应FMaterialId.FNumber */
@Excel(name = "物料编码;对应FMaterialId.FNumber")
private String materialCode;
/** 物料名称;对应FMaterialId.FName */
@Excel(name = "物料名称;对应FMaterialId.FName")
private String materialName;
/** 源单内码;对应FDetailEntity_Link_FSBillId */
@Excel(name = "源单内码;对应FDetailEntity_Link_FSBillId")
private String fsBillId;
/** 源单分录内码;对应FDetailEntity_Link_FSId */
@Excel(name = "源单分录内码;对应FDetailEntity_Link_FSId")
private String fsId;
/** 实到数量;对应FActlandQty */
@Excel(name = "实到数量;对应FActlandQty")
private BigDecimal actLandAmount;
/** 交货数量;对应FActReceiveQty */
@Excel(name = "交货数量;对应FActReceiveQty")
private BigDecimal actReceiveAmount;
/** 审核日期;对应FApproveDate */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "审核日期;对应FApproveDate", width = 30, dateFormat = "yyyy-MM-dd")
private Date approveDate;
/** ERP最后修改日期;对应FModifyDate */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "ERP最后修改日期;对应FModifyDate", width = 30, dateFormat = "yyyy-MM-dd")
private Date erpModifyDate;
/** 收料组织;FPurchaseOrgId */
@Excel(name = "收料组织;FPurchaseOrgId")
private Long purchaseOrgId;
/** 京源项目;F_TOND_Base */
@Excel(name = "京源项目;F_TOND_Base")
private String tondBase;
/** 单价;FPRICE */
@Excel(name = "单价;FPRICE")
private BigDecimal price;
/** 供应商ID;FSupplierId */
@Excel(name = "供应商ID;FSupplierId")
private Long supplierId;
private String materialSpec;
public void setReceiveBillId(Long receiveBillId)
{
this.receiveBillId = receiveBillId;
}
public Long getReceiveBillId()
{
return receiveBillId;
}
public void setErpId(Long erpId)
{
this.erpId = erpId;
}
public Long getErpId()
{
return erpId;
}
public void setFentryId(Long fentryId)
{
this.fentryId = fentryId;
}
public Long getFentryId()
{
return fentryId;
}
public void setBillNo(String billNo)
{
this.billNo = billNo;
}
public String getBillNo()
{
return billNo;
}
public void setPoNo(String poNo)
{
this.poNo = poNo;
}
public String getPoNo()
{
return poNo;
}
public void setDocumentStatus(String documentStatus)
{
this.documentStatus = documentStatus;
}
public String getDocumentStatus()
{
return documentStatus;
}
public void setMaterialId(Long materialId)
{
this.materialId = materialId;
}
public Long getMaterialId()
{
return materialId;
}
public void setMaterialCode(String materialCode)
{
this.materialCode = materialCode;
}
public String getMaterialCode()
{
return materialCode;
}
public void setMaterialName(String materialName)
{
this.materialName = materialName;
}
public String getMaterialName()
{
return materialName;
}
public void setFsBillId(String fsBillId)
{
this.fsBillId = fsBillId;
}
public String getFsBillId()
{
return fsBillId;
}
public void setFsId(String fsId)
{
this.fsId = fsId;
}
public String getFsId()
{
return fsId;
}
public void setActLandAmount(BigDecimal actLandAmount)
{
this.actLandAmount = actLandAmount;
}
public BigDecimal getActLandAmount()
{
return actLandAmount;
}
public void setActReceiveAmount(BigDecimal actReceiveAmount)
{
this.actReceiveAmount = actReceiveAmount;
}
public BigDecimal getActReceiveAmount()
{
return actReceiveAmount;
}
public void setApproveDate(Date approveDate)
{
this.approveDate = approveDate;
}
public Date getApproveDate()
{
return approveDate;
}
public void setErpModifyDate(Date erpModifyDate)
{
this.erpModifyDate = erpModifyDate;
}
public Date getErpModifyDate()
{
return erpModifyDate;
}
public void setPurchaseOrgId(Long purchaseOrgId)
{
this.purchaseOrgId = purchaseOrgId;
}
public Long getPurchaseOrgId()
{
return purchaseOrgId;
}
public void setTondBase(String tondBase)
{
this.tondBase = tondBase;
}
public String getTondBase()
{
return tondBase;
}
public void setPrice(BigDecimal price)
{
this.price = price;
}
public BigDecimal getPrice()
{
return price;
}
public void setSupplierId(Long supplierId)
{
this.supplierId = supplierId;
}
public Long getSupplierId()
{
return supplierId;
}
public String getMaterialSpec() {
return materialSpec;
}
public void setMaterialSpec(String materialSpec) {
this.materialSpec = materialSpec;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("receiveBillId", getReceiveBillId())
.append("erpId", getErpId())
.append("fentryId", getFentryId())
.append("billNo", getBillNo())
.append("poNo", getPoNo())
.append("documentStatus", getDocumentStatus())
.append("materialId", getMaterialId())
.append("materialCode", getMaterialCode())
.append("materialName", getMaterialName())
.append("fsBillId", getFsBillId())
.append("fsId", getFsId())
.append("actLandAmount", getActLandAmount())
.append("actReceiveAmount", getActReceiveAmount())
.append("approveDate", getApproveDate())
.append("erpModifyDate", getErpModifyDate())
.append("purchaseOrgId", getPurchaseOrgId())
.append("tondBase", getTondBase())
.append("price", getPrice())
.append("supplierId", getSupplierId())
.append("remark", getRemark())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

@ -0,0 +1,70 @@
package com.hw.mes.mapper;
import java.util.List;
import com.hw.mes.domain.MesPurchaseReceiveBill;
/**
* Mapper
*
* @author xins
* @date 2024-12-16
*/
public interface MesPurchaseReceiveBillMapper
{
/**
*
*
* @param receiveBillId
* @return
*/
public MesPurchaseReceiveBill selectMesPurchaseReceiveBillByReceiveBillId(Long receiveBillId);
/**
*
*
* @param mesPurchaseReceiveBill
* @return
*/
public List<MesPurchaseReceiveBill> selectMesPurchaseReceiveBillList(MesPurchaseReceiveBill mesPurchaseReceiveBill);
/**
*
*
* @param mesPurchaseReceiveBill
* @return
*/
public int insertMesPurchaseReceiveBill(MesPurchaseReceiveBill mesPurchaseReceiveBill);
/**
*
*
* @param mesPurchaseReceiveBill
* @return
*/
public int updateMesPurchaseReceiveBill(MesPurchaseReceiveBill mesPurchaseReceiveBill);
/**
*
*
* @param receiveBillId
* @return
*/
public int deleteMesPurchaseReceiveBillByReceiveBillId(Long receiveBillId);
/**
*
*
* @param receiveBillIds
* @return
*/
public int deleteMesPurchaseReceiveBillByReceiveBillIds(Long[] receiveBillIds);
/**
* ,join material
*
* @param mesPurchaseReceiveBill
* @return
*/
public List<MesPurchaseReceiveBill> selectMesPurchaseReceiveBillJoinList(MesPurchaseReceiveBill mesPurchaseReceiveBill);
}

@ -0,0 +1,69 @@
package com.hw.mes.service;
import java.util.List;
import com.hw.mes.domain.MesPurchaseReceiveBill;
/**
* Service
*
* @author xins
* @date 2024-12-16
*/
public interface IMesPurchaseReceiveBillService
{
/**
*
*
* @param receiveBillId
* @return
*/
public MesPurchaseReceiveBill selectMesPurchaseReceiveBillByReceiveBillId(Long receiveBillId);
/**
*
*
* @param mesPurchaseReceiveBill
* @return
*/
public List<MesPurchaseReceiveBill> selectMesPurchaseReceiveBillList(MesPurchaseReceiveBill mesPurchaseReceiveBill);
/**
* ,Join material
*
* @param mesPurchaseReceiveBill
* @return
*/
public List<MesPurchaseReceiveBill> selectMesPurchaseReceiveBillJoinList(MesPurchaseReceiveBill mesPurchaseReceiveBill);
/**
*
*
* @param mesPurchaseReceiveBill
* @return
*/
public int insertMesPurchaseReceiveBill(MesPurchaseReceiveBill mesPurchaseReceiveBill);
/**
*
*
* @param mesPurchaseReceiveBill
* @return
*/
public int updateMesPurchaseReceiveBill(MesPurchaseReceiveBill mesPurchaseReceiveBill);
/**
*
*
* @param receiveBillIds
* @return
*/
public int deleteMesPurchaseReceiveBillByReceiveBillIds(Long[] receiveBillIds);
/**
*
*
* @param receiveBillId
* @return
*/
public int deleteMesPurchaseReceiveBillByReceiveBillId(Long receiveBillId);
}

@ -563,6 +563,7 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
MesBaseBarcodeInfo toInsertedBarcodeInfo = new MesBaseBarcodeInfo();
//同一批次的批次代码相同
toInsertedBarcodeInfo.setBatchCode(batchCode);
toInsertedBarcodeInfo.setReceiveBillId(mesBaseBarcodeInfo.getReceiveBillId());
toInsertedBarcodeInfo.setPurchaseOrderId(mesBaseBarcodeInfo.getPurchaseOrderId());
toInsertedBarcodeInfo.setPoNo(mesBaseBarcodeInfo.getPoNo());
toInsertedBarcodeInfo.setBarcodeType(MesConstants.MES_BARCODE_TYPE_RAW);
@ -698,8 +699,8 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
try {
String hostIp = IpUtils.getIpAddr();
if(hostIp.equals("192.168.2.26")){
hostIp = "192.168.2.10";
if(hostIp.equals("192.168.2.10")){
hostIp = "192.168.2.26";
}
String printKey = "print_" + hostIp;
redisTemplate.opsForList().rightPush(printKey, printContentJson.toString());

@ -6,12 +6,14 @@ import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import com.hw.common.core.constant.CacheConstants;
import com.hw.common.core.constant.SecurityConstants;
import com.hw.common.core.domain.R;
import com.hw.common.core.exception.ServiceException;
import com.hw.common.core.utils.DateUtils;
import com.hw.common.core.utils.MailUtils;
import com.hw.common.core.utils.StringUtils;
import com.hw.common.redis.service.RedisService;
import com.hw.mes.domain.MesBaseAttachInfo;
import com.hw.mes.service.IMesBaseAttachInfoService;
import com.hw.system.api.RemoteUserService;
@ -41,6 +43,9 @@ public class MesMaterialBomServiceImpl implements IMesMaterialBomService {
@Autowired
private IMesBaseAttachInfoService mesBaseAttachInfoService;
@Autowired
private RedisService redisService;
/**
* BOM
*
@ -258,9 +263,18 @@ public class MesMaterialBomServiceImpl implements IMesMaterialBomService {
} else {
sendMsg.append("SOP已维护成功");
}
String emailAccountInfo = redisService.getCacheObject(CacheConstants.SYS_EAMIL_ACCOUNT_INFO);
String emailAccount = "";
String emailPassword = "";
if(StringUtils.isNotEmpty(emailAccountInfo)){
int splitIndex = emailAccountInfo.indexOf(",");
emailAccount = emailAccountInfo.substring(0,splitIndex);
emailPassword = emailAccountInfo.substring(splitIndex+1);
}
for (SysUser sysUser : sysUserList) {
String email = sysUser.getEmail();
MailUtils.processSendEmail(email, "通知", sendMsg.toString());
MailUtils.processSendEmail(emailAccount,emailPassword,email, "上传图纸通知", sendMsg.toString());
}
mesMaterialBom.setUpdateTime(DateUtils.getNowDate());
return mesMaterialBomMapper.updateMesMaterialBom(mesMaterialBom);

@ -0,0 +1,109 @@
package com.hw.mes.service.impl;
import java.util.List;
import com.hw.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hw.mes.mapper.MesPurchaseReceiveBillMapper;
import com.hw.mes.domain.MesPurchaseReceiveBill;
import com.hw.mes.service.IMesPurchaseReceiveBillService;
/**
* Service
*
* @author xins
* @date 2024-12-16
*/
@Service
public class MesPurchaseReceiveBillServiceImpl implements IMesPurchaseReceiveBillService
{
@Autowired
private MesPurchaseReceiveBillMapper mesPurchaseReceiveBillMapper;
/**
*
*
* @param receiveBillId
* @return
*/
@Override
public MesPurchaseReceiveBill selectMesPurchaseReceiveBillByReceiveBillId(Long receiveBillId)
{
return mesPurchaseReceiveBillMapper.selectMesPurchaseReceiveBillByReceiveBillId(receiveBillId);
}
/**
*
*
* @param mesPurchaseReceiveBill
* @return
*/
@Override
public List<MesPurchaseReceiveBill> selectMesPurchaseReceiveBillList(MesPurchaseReceiveBill mesPurchaseReceiveBill)
{
return mesPurchaseReceiveBillMapper.selectMesPurchaseReceiveBillList(mesPurchaseReceiveBill);
}
/**
* ,Join material
*
* @param mesPurchaseReceiveBill
* @return
*/
@Override
public List<MesPurchaseReceiveBill> selectMesPurchaseReceiveBillJoinList(MesPurchaseReceiveBill mesPurchaseReceiveBill)
{
return mesPurchaseReceiveBillMapper.selectMesPurchaseReceiveBillJoinList(mesPurchaseReceiveBill);
}
/**
*
*
* @param mesPurchaseReceiveBill
* @return
*/
@Override
public int insertMesPurchaseReceiveBill(MesPurchaseReceiveBill mesPurchaseReceiveBill)
{
mesPurchaseReceiveBill.setCreateTime(DateUtils.getNowDate());
return mesPurchaseReceiveBillMapper.insertMesPurchaseReceiveBill(mesPurchaseReceiveBill);
}
/**
*
*
* @param mesPurchaseReceiveBill
* @return
*/
@Override
public int updateMesPurchaseReceiveBill(MesPurchaseReceiveBill mesPurchaseReceiveBill)
{
mesPurchaseReceiveBill.setUpdateTime(DateUtils.getNowDate());
return mesPurchaseReceiveBillMapper.updateMesPurchaseReceiveBill(mesPurchaseReceiveBill);
}
/**
*
*
* @param receiveBillIds
* @return
*/
@Override
public int deleteMesPurchaseReceiveBillByReceiveBillIds(Long[] receiveBillIds)
{
return mesPurchaseReceiveBillMapper.deleteMesPurchaseReceiveBillByReceiveBillIds(receiveBillIds);
}
/**
*
*
* @param receiveBillId
* @return
*/
@Override
public int deleteMesPurchaseReceiveBillByReceiveBillId(Long receiveBillId)
{
return mesPurchaseReceiveBillMapper.deleteMesPurchaseReceiveBillByReceiveBillId(receiveBillId);
}
}

@ -24,6 +24,7 @@
<result property="productBarcode" column="product_barcode"/>
<result property="machineName" column="machine_name"/>
<result property="printNumber" column="print_number"/>
<result property="receiveBillId" column="receive_bill_id"/>
<result property="purchaseOrderId" column="purchase_order_id"/>
<result property="poNo" column="po_no"/>
<result property="productionDate" column="production_date"/>
@ -195,6 +196,7 @@
<if test="productBarcode != null">product_barcode,</if>
<if test="machineName != null">machine_name,</if>
<if test="printNumber != null">print_number,</if>
<if test="receiveBillId != null">receive_bill_id,</if>
<if test="purchaseOrderId != null">purchase_order_id,</if>
<if test="poNo != null">po_no,</if>
<if test="productionDate != null">production_date,</if>
@ -234,6 +236,7 @@
<if test="productBarcode != null">#{productBarcode},</if>
<if test="machineName != null">#{machineName},</if>
<if test="printNumber != null">#{printNumber},</if>
<if test="receiveBillId != null">#{receiveBillId},</if>
<if test="purchaseOrderId != null">#{purchaseOrderId},</if>
<if test="poNo != null">#{poNo},</if>
<if test="productionDate != null">#{productionDate},</if>

@ -214,7 +214,7 @@
<if test="projectId != null ">and mmb.project_id = #{projectId}</if>
<if test="activeFlag != null and activeFlag != ''">and mmb.active_flag = #{activeFlag}</if>
</where>
order by mmb.material_bom_id desc
order by mmb.create_time desc
</select>
<insert id="batchMesMaterialBom">

@ -396,7 +396,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from mes_purchase_order mpo
left join mes_base_material_info mbmi on mbmi.erp_id = mpo.material_id
<where>
<if test="poNo != null and poNo != ''"> and mpo.po_no like concat('%', #{poNo}, '%')</if>
<if test="poNo != null and poNo != ''"> and mpo.po_no = #{poNo}</if>
<if test="materialId != null "> and mpo.material_id = #{materialId}</if>
<if test="materialCode != null and materialCode != ''"> and mbmi.material_code like concat('%', #{materialCode}, '%')</if>
<if test="materialName != null and materialName != ''"> and mbmi.material_name like concat('%', #{materialName}, '%')</if>
<if test="specificationParameter != null and specificationParameter != ''"> and mpo.specification_parameter like concat('%', #{specificationParameter}, '%')</if>
@ -476,6 +477,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="productCode != null and productCode != ''"> and pbmi.material_code like concat('%', #{productCode}, '%')</if>
<if test="productName != null and productName != ''"> and pbmi.material_name like concat('%', #{productName}, '%')</if>
<if test="poNo != null and poNo != ''"> and mpo.po_no like concat('%', #{poNo}, '%')</if>
<if test="materialId != null "> and mpo.material_id = #{materialId}</if>
<if test="materialCode != null and materialCode != ''"> and mbmi.material_code like concat('%', #{materialCode}, '%')</if>
<if test="materialName != null and materialName != ''"> and mbmi.material_name like concat('%', #{materialName}, '%')</if>
<if test="materialSpec != null and materialSpec != ''">and replace(mbmi.material_spec,' ','') like concat('%', #{materialSpec},

@ -0,0 +1,186 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hw.mes.mapper.MesPurchaseReceiveBillMapper">
<resultMap type="MesPurchaseReceiveBill" id="MesPurchaseReceiveBillResult">
<result property="receiveBillId" column="receive_bill_id" />
<result property="erpId" column="erp_id" />
<result property="fentryId" column="fentry_id" />
<result property="billNo" column="bill_no" />
<result property="poNo" column="po_no" />
<result property="documentStatus" column="document_status" />
<result property="materialId" column="material_id" />
<result property="materialCode" column="material_code" />
<result property="materialName" column="material_name" />
<result property="fsBillId" column="fs_bill_id" />
<result property="fsId" column="fs_id" />
<result property="actLandAmount" column="act_land_amount" />
<result property="actReceiveAmount" column="act_receive_amount" />
<result property="approveDate" column="approve_date" />
<result property="erpModifyDate" column="erp_modify_date" />
<result property="purchaseOrgId" column="purchase_org_id" />
<result property="tondBase" column="tond_base" />
<result property="price" column="price" />
<result property="supplierId" column="supplier_id" />
<result property="remark" column="remark" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="materialSpec" column="material_spec" />
</resultMap>
<sql id="selectMesPurchaseReceiveBillVo">
select receive_bill_id, erp_id, fentry_id, bill_no, po_no, document_status, material_id, material_code, material_name, fs_bill_id, fs_id, act_land_amount, act_receive_amount, approve_date, erp_modify_date, purchase_org_id, tond_base, price, supplier_id, remark, create_by, create_time, update_by, update_time from mes_purchase_receive_bill
</sql>
<select id="selectMesPurchaseReceiveBillList" parameterType="MesPurchaseReceiveBill" resultMap="MesPurchaseReceiveBillResult">
<include refid="selectMesPurchaseReceiveBillVo"/>
<where>
<if test="erpId != null "> and erp_id = #{erpId}</if>
<if test="fentryId != null "> and fentry_id = #{fentryId}</if>
<if test="billNo != null and billNo != ''"> and bill_no = #{billNo}</if>
<if test="poNo != null and poNo != ''"> and po_no = #{poNo}</if>
<if test="documentStatus != null and documentStatus != ''"> and document_status = #{documentStatus}</if>
<if test="materialId != null "> and material_id = #{materialId}</if>
<if test="materialCode != null and materialCode != ''"> and material_code = #{materialCode}</if>
<if test="materialName != null and materialName != ''"> and material_name like concat('%', #{materialName}, '%')</if>
<if test="fsBillId != null and fsBillId != ''"> and fs_bill_id = #{fsBillId}</if>
<if test="fsId != null and fsId != ''"> and fs_id = #{fsId}</if>
<if test="actLandAmount != null "> and act_land_amount = #{actLandAmount}</if>
<if test="actReceiveAmount != null "> and act_receive_amount = #{actReceiveAmount}</if>
<if test="approveDate != null "> and approve_date = #{approveDate}</if>
<if test="erpModifyDate != null "> and erp_modify_date = #{erpModifyDate}</if>
<if test="purchaseOrgId != null "> and purchase_org_id = #{purchaseOrgId}</if>
<if test="tondBase != null and tondBase != ''"> and tond_base = #{tondBase}</if>
<if test="price != null "> and price = #{price}</if>
<if test="supplierId != null "> and supplier_id = #{supplierId}</if>
</where>
</select>
<select id="selectMesPurchaseReceiveBillByReceiveBillId" parameterType="Long" resultMap="MesPurchaseReceiveBillResult">
<include refid="selectMesPurchaseReceiveBillVo"/>
where receive_bill_id = #{receiveBillId}
</select>
<insert id="insertMesPurchaseReceiveBill" parameterType="MesPurchaseReceiveBill" useGeneratedKeys="true" keyProperty="receiveBillId">
insert into mes_purchase_receive_bill
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="erpId != null">erp_id,</if>
<if test="fentryId != null">fentry_id,</if>
<if test="billNo != null">bill_no,</if>
<if test="poNo != null">po_no,</if>
<if test="documentStatus != null">document_status,</if>
<if test="materialId != null">material_id,</if>
<if test="materialCode != null and materialCode != ''">material_code,</if>
<if test="materialName != null">material_name,</if>
<if test="fsBillId != null">fs_bill_id,</if>
<if test="fsId != null">fs_id,</if>
<if test="actLandAmount != null">act_land_amount,</if>
<if test="actReceiveAmount != null">act_receive_amount,</if>
<if test="approveDate != null">approve_date,</if>
<if test="erpModifyDate != null">erp_modify_date,</if>
<if test="purchaseOrgId != null">purchase_org_id,</if>
<if test="tondBase != null">tond_base,</if>
<if test="price != null">price,</if>
<if test="supplierId != null">supplier_id,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="erpId != null">#{erpId},</if>
<if test="fentryId != null">#{fentryId},</if>
<if test="billNo != null">#{billNo},</if>
<if test="poNo != null">#{poNo},</if>
<if test="documentStatus != null">#{documentStatus},</if>
<if test="materialId != null">#{materialId},</if>
<if test="materialCode != null and materialCode != ''">#{materialCode},</if>
<if test="materialName != null">#{materialName},</if>
<if test="fsBillId != null">#{fsBillId},</if>
<if test="fsId != null">#{fsId},</if>
<if test="actLandAmount != null">#{actLandAmount},</if>
<if test="actReceiveAmount != null">#{actReceiveAmount},</if>
<if test="approveDate != null">#{approveDate},</if>
<if test="erpModifyDate != null">#{erpModifyDate},</if>
<if test="purchaseOrgId != null">#{purchaseOrgId},</if>
<if test="tondBase != null">#{tondBase},</if>
<if test="price != null">#{price},</if>
<if test="supplierId != null">#{supplierId},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateMesPurchaseReceiveBill" parameterType="MesPurchaseReceiveBill">
update mes_purchase_receive_bill
<trim prefix="SET" suffixOverrides=",">
<if test="erpId != null">erp_id = #{erpId},</if>
<if test="fentryId != null">fentry_id = #{fentryId},</if>
<if test="billNo != null">bill_no = #{billNo},</if>
<if test="poNo != null">po_no = #{poNo},</if>
<if test="documentStatus != null">document_status = #{documentStatus},</if>
<if test="materialId != null">material_id = #{materialId},</if>
<if test="materialCode != null and materialCode != ''">material_code = #{materialCode},</if>
<if test="materialName != null">material_name = #{materialName},</if>
<if test="fsBillId != null">fs_bill_id = #{fsBillId},</if>
<if test="fsId != null">fs_id = #{fsId},</if>
<if test="actLandAmount != null">act_land_amount = #{actLandAmount},</if>
<if test="actReceiveAmount != null">act_receive_amount = #{actReceiveAmount},</if>
<if test="approveDate != null">approve_date = #{approveDate},</if>
<if test="erpModifyDate != null">erp_modify_date = #{erpModifyDate},</if>
<if test="purchaseOrgId != null">purchase_org_id = #{purchaseOrgId},</if>
<if test="tondBase != null">tond_base = #{tondBase},</if>
<if test="price != null">price = #{price},</if>
<if test="supplierId != null">supplier_id = #{supplierId},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where receive_bill_id = #{receiveBillId}
</update>
<delete id="deleteMesPurchaseReceiveBillByReceiveBillId" parameterType="Long">
delete from mes_purchase_receive_bill where receive_bill_id = #{receiveBillId}
</delete>
<delete id="deleteMesPurchaseReceiveBillByReceiveBillIds" parameterType="String">
delete from mes_purchase_receive_bill where receive_bill_id in
<foreach item="receiveBillId" collection="array" open="(" separator="," close=")">
#{receiveBillId}
</foreach>
</delete>
<select id="selectMesPurchaseReceiveBillJoinList" parameterType="MesPurchaseReceiveBill" resultMap="MesPurchaseReceiveBillResult">
select mprb.receive_bill_id, mprb.erp_id, mprb.fentry_id, mprb.bill_no, mprb.po_no, mprb.document_status,
mprb.material_id, mbmi.material_code, mbmi.material_name, mbmi.material_spec,mprb.fs_bill_id, mprb.fs_id,
mprb.act_land_amount, mprb.act_receive_amount, mprb.approve_date, mprb.erp_modify_date,
mprb.purchase_org_id, mprb.tond_base, mprb.price, mprb.supplier_id, mprb.remark, mprb.create_by,
mprb.create_time, mprb.update_by, mprb.update_time from mes_purchase_receive_bill mprb
left join mes_base_material_info mbmi on mprb.material_id=mbmi.erp_id
<where>
<if test="billNo != null and billNo != ''"> and mprb.bill_no like concat('%', #{billNo}, '%')</if>
<if test="poNo != null and poNo != ''"> and mprb.po_no like concat('%', #{poNo}, '%')</if>
<if test="materialCode != null and materialCode != ''"> and mbmi.material_code like concat('%', #{materialCode}, '%')</if>
<if test="materialName != null and materialName != ''"> and mbmi.material_name like concat('%', #{materialName}, '%')</if>
<if test="materialSpec != null and materialSpec != ''"> and mbmi.material_spec like concat('%', #{materialSpec}, '%')</if>
</where>
order by mprb.erp_modify_date desc
</select>
</mapper>

@ -6,14 +6,17 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.hw.common.core.constant.CacheConstants;
import com.hw.common.core.utils.DateUtils;
import com.hw.common.core.utils.MailUtils;
import com.hw.common.core.utils.StringUtils;
import com.hw.common.redis.service.RedisService;
import com.hw.common.security.utils.SecurityUtils;
import com.hw.system.api.domain.SysUser;
import com.hw.system.common.mapper.WfProcessActivityAuthMapper;
import com.hw.system.mapper.SysUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import com.hw.system.common.mapper.SysPointRouterMapper;
import com.hw.system.api.domain.common.SysPointRouter;
@ -34,6 +37,9 @@ public class SysPointRouterServiceImpl implements ISysPointRouterService {
@Autowired
private SysUserMapper sysUserMapper;
@Autowired
public RedisService redisService;
/**
*
*
@ -123,11 +129,22 @@ public class SysPointRouterServiceImpl implements ISysPointRouterService {
*/
@Override
public int processActivityEmailNotify() {
String emailAccountInfo = redisService.getCacheObject(CacheConstants.SYS_EAMIL_ACCOUNT_INFO);
String emailAccount = "";
String emailPassword = "";
if(StringUtils.isNotEmpty(emailAccountInfo)){
int splitIndex = emailAccountInfo.indexOf(",");
emailAccount = emailAccountInfo.substring(0,splitIndex);
emailPassword = emailAccountInfo.substring(splitIndex+1);
}
System.out.println(emailAccount+"e:"+emailPassword);
SysPointRouter queryPointRouter = new SysPointRouter();
List<SysPointRouter> sysPointRouterList = sysPointRouterMapper.selectEmailNotifySysPointRouterList(queryPointRouter);
//根据流程节点ID group
Map<Long, List<SysPointRouter>> sysPointRouterMap = sysPointRouterList.stream()
.filter(spo->spo.getProcessActivityId()!=null).collect(Collectors.groupingBy(SysPointRouter::getProcessActivityId));
.filter(spo -> spo.getProcessActivityId() != null).collect(Collectors.groupingBy(SysPointRouter::getProcessActivityId));
for (Long processActivityId : sysPointRouterMap.keySet()) {
List<SysPointRouter> sysPointRoutersByActivityList = sysPointRouterMap.get(processActivityId);
@ -143,7 +160,7 @@ public class SysPointRouterServiceImpl implements ISysPointRouterService {
for (SysUser sysUser : sysUsers) {
if (StringUtils.isNotEmpty(sysUser.getEmail())) {
MailUtils.processSendEmail(sysUser.getEmail(), "通知", sendMsg);
MailUtils.processSendEmail(emailAccount,emailPassword,sysUser.getEmail(), "通知", sendMsg);
}
}

@ -29,4 +29,7 @@ public class WmsProductOutstockAuditVo {
//审核意见
private String auditReason;
//人工标识
private String manualFlag;
}

@ -161,4 +161,6 @@ public interface WmsProductStockMapper
BigDecimal monthInstockAmount();
List<WmsProductStock> selectFourthProductStockPercentage();
public WmsProductStock selectProductStockByLocationCode(String locationCode);
}

@ -92,30 +92,67 @@ public class WmsProductOutstockDetailServiceImpl implements IWmsProductOutstockD
//在PDA成品出库需要选择出库的申请单然后输入库位码和物料条码
Long productOutstockId = wmsProductOutstockDetail.getProductOutstockId();
R<MesBaseBarcodeInfo> baseBarcodeInfoR = remoteMesService.getBarcode(productBarcode, SecurityConstants.INNER);
if (baseBarcodeInfoR == null) {
throw new ServiceException("物料条码有误");
}
MesBaseBarcodeInfo baseBarcodeInfo = baseBarcodeInfoR.getData();
if (baseBarcodeInfo == null) {
throw new ServiceException("物料条码有误");
}
WmsProductOutstock productOutstock = wmsProductOutstockMapper.selectOnlyWmsProductOutstockByOutstockId(productOutstockId);
if (productOutstock == null) {
throw new ServiceException("没有此成品出库任务信息");
}
if(!productOutstock.getProductId().equals(baseBarcodeInfo.getMaterialId())) {
throw new ServiceException("物料条码有误");
}
WmsProductStock productStock = null;
String executeStatus = "";
String userName = SecurityUtils.getLoginUser()==null ? SecurityUtils.getUsername() :SecurityUtils.getLoginUser().getNickname();
Date currentDate = new Date();
//一楼成品库和四楼成品库没有库位
if(StringUtils.isEmpty(locationCode) &&
(wmsConfig.getFirstFloorProductWarehouseId().equals(productOutstock.getWarehouseId()) ||
wmsConfig.getFourthFloorProductWarehouseId().equals(productOutstock.getWarehouseId()))){
R<MesBaseBarcodeInfo> baseBarcodeInfoR = remoteMesService.getBarcode(productBarcode, SecurityConstants.INNER);
if (baseBarcodeInfoR == null) {
throw new ServiceException("物料条码有误");
}
MesBaseBarcodeInfo baseBarcodeInfo = baseBarcodeInfoR.getData();
if (baseBarcodeInfo == null) {
throw new ServiceException("物料条码有误");
}
if(!productOutstock.getProductId().equals(baseBarcodeInfo.getMaterialId())) {
throw new ServiceException("物料条码有误");
}
locationCode = "0";
executeStatus = WmsConstants.WMS_EXECUTE_STATUS_FINISH;
wmsProductOutstockDetail.setLocationCode("0");
wmsProductOutstockDetail.setOutstockAmount(BigDecimal.ONE);
productStock = wmsProductStockMapper.selectProductStockByBatch(productBarcode);
wmsProductStockMapper.deleteWmsProductStockByProductStockId(productStock.getProductStockId());
/**判断已出库数量和申请的数量*/
BigDecimal applyQty = productOutstock.getApplyQty() == null ? BigDecimal.ZERO : productOutstock.getApplyQty();
BigDecimal outstockQty = productOutstock.getOutstockQty() == null ? BigDecimal.ZERO : productOutstock.getOutstockQty();
BigDecimal currentOutstockQty = outstockQty.add(BigDecimal.ONE);
if (applyQty.compareTo(currentOutstockQty) < 0) {
throw new ServiceException(String.format("出库申请数量为%1$s不能再出库", applyQty));
}
//更新出库记录
if (applyQty.compareTo(currentOutstockQty) == 0) {
productOutstock.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_FINISH);
productOutstock.setEndTime(currentDate);
} else if (applyQty.compareTo(currentOutstockQty) > 0) {
productOutstock.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_EXECUTING);
}
productOutstock.setOutstockQty(currentOutstockQty);
if (productOutstock.getBeginTime() == null) {
productOutstock.setBeginTime(currentDate);
}
productOutstock.setUpdateDate(currentDate);
productOutstock.setUpdateBy(userName);
wmsProductOutstockMapper.updateWmsProductOutstock(productOutstock);
}else{
WmsBaseLocation location = wmsBaseLocationMapper.selectWmsBaseLocationByLocationCode(locationCode);
if (location == null) {
@ -124,13 +161,25 @@ public class WmsProductOutstockDetailServiceImpl implements IWmsProductOutstockD
if (!productOutstock.getWarehouseId().equals(location.getWarehouseId())) {
throw new ServiceException("没有此仓库出库任务");
}
if(!location.getLocationStatus().equals(WmsConstants.WMS_BASE_LOCATION_STATUS_NORMAL)){
throw new ServiceException("库位状态非正常");
}
if(!productOutstock.getOperationType().equals(WmsConstants.WMS_OPERATION_TYPE_MANUAL)){
throw new ServiceException("此成品出库申请为非人工出库");
}
productStock = wmsProductStockMapper.selectProductStockByLocationCode(locationCode);
executeStatus = WmsConstants.WMS_EXECUTE_STATUS_TOEXECUTE;
productBarcode = StringUtils.isEmpty(productStock.getProductBatch()) ? "0":productStock.getProductBatch();
wmsProductOutstockDetail.setProductBarcode(productBarcode);
wmsProductOutstockDetail.setOutstockAmount(BigDecimal.ZERO);
}
if (productOutstock.getExecuteStatus().equals(WmsConstants.WMS_EXECUTE_STATUS_FINISH)) {
throw new ServiceException("此出库申请已完成,不能再出库");
}
WmsProductStock productStock = wmsProductStockMapper.selectProductStockByBatch(productBarcode);
if (productStock == null || !productStock.getSaleOrderId().equals(productOutstock.getSaleOrderId())) {
throw new ServiceException("此库位没有对应订单库存");
}
@ -145,47 +194,21 @@ public class WmsProductOutstockDetailServiceImpl implements IWmsProductOutstockD
}
/**判断已出库数量和申请的数量*/
BigDecimal applyQty = productOutstock.getApplyQty() == null ? BigDecimal.ZERO : productOutstock.getApplyQty();
BigDecimal outstockQty = productOutstock.getOutstockQty() == null ? BigDecimal.ZERO : productOutstock.getOutstockQty();
BigDecimal currentOutstockQty = outstockQty.add(BigDecimal.ONE);
if (applyQty.compareTo(currentOutstockQty) < 0) {
throw new ServiceException(String.format("出库申请数量为%1$s不能再出库", applyQty));
}
String userName = SecurityUtils.getLoginUser()==null ? SecurityUtils.getUsername() :SecurityUtils.getLoginUser().getNickname();
Date currentDate = new Date();
//更新出库记录
if (applyQty.compareTo(currentOutstockQty) == 0) {
productOutstock.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_FINISH);
productOutstock.setEndTime(currentDate);
} else if (applyQty.compareTo(currentOutstockQty) > 0) {
productOutstock.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_EXECUTING);
}
productOutstock.setOutstockQty(currentOutstockQty);
if (productOutstock.getBeginTime() == null) {
productOutstock.setBeginTime(currentDate);
}
productOutstock.setUpdateDate(currentDate);
productOutstock.setUpdateBy(userName);
wmsProductOutstockMapper.updateWmsProductOutstock(productOutstock);
//删除库存(由于一个成品对应一个库存信息,删除即可)
// productStock.setTotalAmount(totalAmount.subtract(BigDecimal.ONE));
// productStock.setUpdateBy(userName);
// productStock.setUpdateDate(currentDate);
// wmsProductStockMapper.updateWmsProductStock(productStock);
wmsProductStockMapper.deleteWmsProductStockByProductStockId(productStock.getProductStockId());
//插入出库记录明细
wmsProductOutstockDetail.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_FINISH);
wmsProductOutstockDetail.setExecuteStatus(executeStatus);
wmsProductOutstockDetail.setBeginTime(currentDate);
wmsProductOutstockDetail.setEndTime(currentDate);
wmsProductOutstockDetail.setWarehouseId(productStock.getWarehouseId());
wmsProductOutstockDetail.setPlanAmount(BigDecimal.ONE);
wmsProductOutstockDetail.setOutstockAmount(BigDecimal.ONE);
wmsProductOutstockDetailMapper.insertWmsProductOutstockDetail(wmsProductOutstockDetail);

@ -558,6 +558,7 @@ public class WmsProductOutstockServiceImpl implements IWmsProductOutstockService
}
wmsProductOutstock.setOperationType(wmsProductOutstockAuditVo.getManualFlag());
wmsProductOutstock.setAuditStatus(auditStatus);
wmsProductOutstock.setAuditReason(auditReason);
wmsProductOutstock.setAuditBy(userName);

@ -432,6 +432,12 @@
</select>
<select id="selectProductStockByLocationCode" resultMap="WmsProductStockResult">
<include refid="selectWmsProductStockVo"/>
where location_code = #{locationCode} limit 1
</select>
<!--select id="selectWmsProductStocksBySaleorder" parameterType="WmsProductStock" resultMap="WmsProductStockResult">
select wgb.warehouse_id,wgb.saleorder_code,wgb.product_id,mso.order_amount,wgb.total_amount,wgb.frozen_amount,wgb.occupy_amount,wbw.warehouse_name,mbmi.material_code,mbmi.material_name from mes_sale_order mso left join
(select wps.warehouse_id,wps.saleorder_code,wps.product_id,sum(total_amount) total_amount,sum(frozen_amount) frozen_amount,sum(occupy_amount) occupy_amount from wms_product_stock wps where wps.total_amount>0 and wps.stock_type='3'

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询收料通知单列表
export function listPurchaseReceiveBill(query) {
return request({
url: '/mes/purchaseReceiveBill/list',
method: 'get',
params: query
})
}
// 查询收料通知单详细
export function getPurchaseReceiveBill(receiveBillId) {
return request({
url: '/mes/purchaseReceiveBill/' + receiveBillId,
method: 'get'
})
}
// 新增收料通知单
export function addPurchaseReceiveBill(data) {
return request({
url: '/mes/purchaseReceiveBill',
method: 'post',
data: data
})
}
// 修改收料通知单
export function updatePurchaseReceiveBill(data) {
return request({
url: '/mes/purchaseReceiveBill',
method: 'put',
data: data
})
}
// 删除收料通知单
export function delPurchaseReceiveBill(receiveBillId) {
return request({
url: '/mes/purchaseReceiveBill/' + receiveBillId,
method: 'delete'
})
}

@ -1223,6 +1223,7 @@ export default {
let selectedRow = this.$refs.purchaseOrderRef.selectedRow;
this.form.batchFlag = null;
this.form.amount = null;
this.form.receiveBillId = null;
this.form.materialCode = null;
this.form.materialId = null;
this.form.materialName = null;
@ -1251,6 +1252,7 @@ export default {
this.form.materialName = selectedRow.materialName;
this.form.materialSpec = selectedRow.materialSpec;
this.form.projectNo = selectedRow.projectNo;
this.form.receiveBillId = selectedRow.receiveBillId;
this.form.purchaseOrderId = selectedRow.purchaseOrderId;
if (selectedRow.specificationParameter && selectedRow.specificationParameter !== null && selectedRow.specificationParameter !== '') {
this.form.barcodeSpec = selectedRow.specificationParameter;
@ -1258,7 +1260,6 @@ export default {
this.form.barcodeSpec = selectedRow.materialSpec;
}
//
this.form.availableBindAmount = parseInt(selectedRow.relateSaleOrderAmount);
this.form.orderBindId = selectedRow.orderBindId;
@ -1742,6 +1743,7 @@ export default {
this.regularForm.materialId = selectedRow.materialId;
this.regularForm.materialName = selectedRow.materialName;
this.regularForm.barcodeSpec = selectedRow.materialSpec;
this.regularForm.poNo = null;
this.selectMaterialVisible = false;
@ -1897,6 +1899,7 @@ export default {
this.$set(this.regularForm, "poNo", selectedRow.poNo);
this.regularForm.purchaseOrderId = selectedRow.purchaseOrderId;
this.regularForm.receiveBillId = selectedRow.receiveBillId;
this.regularForm.materialId = selectedRow.materialId;//ID
this.regularForm.materialCode = selectedRow.materialCode;
this.regularForm.materialName = selectedRow.materialName;

@ -1,46 +1,53 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item label="采购订单编号" prop="poNo">
<el-input
v-model="queryParams.poNo"
placeholder="请输入采购订单编号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="物料编码" prop="materialCode">
<el-input
v-model="queryParams.materialCode"
placeholder="请输入物料编码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="物料名称" prop="materialName">
<el-input
v-model="queryParams.materialName"
placeholder="请输入物料名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="物料规格" prop="materialSpec">
<el-input
v-model="queryParams.materialSpec"
placeholder="请输入物料规格"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="规格参数" prop="specificationParameter">
<el-input
v-model="queryParams.specificationParameter"
placeholder="请输入规格参数"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-row>
<el-form-item label="收料通知单号" prop="billNo">
<el-input v-model="queryParams.billNo" placeholder="请点击右侧检索收料通知单" style="width:400px;" disabled>
<el-button slot="append" icon="el-icon-search" @click="handlePurchaseReceiveBill"></el-button>
</el-input>
</el-form-item>
</el-row>
<!-- <el-form-item label="采购订单编号" prop="poNo">-->
<!-- <el-input-->
<!-- v-model="queryParams.poNo"-->
<!-- placeholder="请输入采购订单编号"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="物料编码" prop="materialCode">-->
<!-- <el-input-->
<!-- v-model="queryParams.materialCode"-->
<!-- placeholder="请输入物料编码"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="物料名称" prop="materialName">-->
<!-- <el-input-->
<!-- v-model="queryParams.materialName"-->
<!-- placeholder="请输入物料名称"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="物料规格" prop="materialSpec">-->
<!-- <el-input-->
<!-- v-model="queryParams.materialSpec"-->
<!-- placeholder="请输入物料规格"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="规格参数" prop="specificationParameter">-->
<!-- <el-input-->
<!-- v-model="queryParams.specificationParameter"-->
<!-- placeholder="请输入规格参数"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
@ -138,6 +145,17 @@
@pagination="getList"
/>
<!-- 选择收料通知单对话框 -->
<el-dialog title="选择收料通知单信息" :visible.sync="purchaseReceiveBillOpen" append-to-body>
<select-purchase-receive-bill ref="purchaseOrderRef" v-if="purchaseReceiveBillOpen"></select-purchase-receive-bill>
<div slot="footer" class="dialog-footer">
<el-button
type="primary" @click="submitPurchaseReceiveBillForm"> </el-button>
<el-button @click="purchaseReceiveBillOpen = false"> </el-button>
</div>
</el-dialog>
</div>
</template>
@ -150,9 +168,15 @@ import {
updatePurchaseOrder
} from "@//api/mes/purchaseOrder";
import selectPurchaseReceiveBill from '@//views/mes/purchaseReceiveBill/selectPurchaseReceiveBill.vue';
export default {
name: "PurchaseOrder",
dicts: ['active_flag', 'order_status', 'document_status'],
components: {
'select-purchase-receive-bill': selectPurchaseReceiveBill,
},
props: {
defineData: {
type: Object,
@ -162,7 +186,7 @@ export default {
data() {
return {
//
loading: true,
loading: false,
//
ids: [],
//
@ -187,6 +211,7 @@ export default {
pageSize: 10,
erpId: null,
fentryId: null,
billNo:null,
poNo: null,
documentStatus: null,
materialId: null,
@ -244,12 +269,13 @@ export default {
{key: 21, label: `更新人`, visible: false},
{key: 22, label: `更新时间`, visible: false},
],
selectedRows:[]
selectedRows:[],
purchaseReceiveBillOpen:false
};
},
created() {
this.getData();
this.getList();
// this.getList();
},
methods: {
getData() {
@ -263,6 +289,10 @@ export default {
/** 查询采购订单信息列表 */
getList() {
if(this.queryParams.billNo==null ||this.queryParams.billNo==='') {
this.$modal.msgWarning("请先选择收料通知单");
return;
}
this.loading = true;
selectPurchaseOrderBindList(this.queryParams).then(response => {
response.rows.forEach(e => {
@ -390,11 +420,33 @@ export default {
handleSelect(row){
this.selectedRow = row;
this.selectedRowId = row.purchaseOrderId;
this.selectedRow.receiveBillId = this.queryParams.receiveBillId;
//
this.$nextTick(() => {
this.$refs.purchaseOrderRef.setCurrentRow(row);
});
},
handlePurchaseReceiveBill() {
this.purchaseReceiveBillOpen = true;
},
submitPurchaseReceiveBillForm() {
let selectedRow = this.$refs.purchaseOrderRef.selectedRow;
this.$set(this.queryParams, "receiveBillId", null);
this.$set(this.queryParams, "billNo", null);
this.$set(this.queryParams, "poNo", null);
this.$set(this.queryParams, "materialId", null);
this.$set(this.queryParams, "receiveBillId", selectedRow.receiveBillId);
this.$set(this.queryParams, "billNo", selectedRow.billNo);
this.$set(this.queryParams, "poNo", selectedRow.poNo);
this.$set(this.queryParams, "materialId", selectedRow.materialId);
this.getList();
this.purchaseReceiveBillOpen = false;
},
}
};
</script>

@ -1,57 +1,65 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
<el-row>
<el-form-item label="收料通知单号" prop="billNo">
<el-input v-model="queryParams.billNo" placeholder="请点击右侧检索收料通知单" style="width:400px;" disabled>
<el-button slot="append" icon="el-icon-search" @click="handlePurchaseReceiveBill"></el-button>
</el-input>
</el-form-item>
</el-row>
<el-form-item label="采购订单编号" prop="poNo">
<el-input
v-model="queryParams.poNo"
placeholder="请输入采购订单编号"
clearable
@keyup.enter.native="handleQuery"
disabled
/>
</el-form-item>
<el-form-item label="物料编码" prop="materialCode">
<el-input
v-model="queryParams.materialCode"
placeholder="请输入物料编码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="物料名称" prop="materialName">
<el-input
v-model="queryParams.materialName"
placeholder="请输入物料名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="物料规格" prop="materialSpec">
<el-input
v-model="queryParams.materialSpec"
placeholder="请输入物料规格"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="规格参数" prop="specificationParameter">
<el-input
v-model="queryParams.specificationParameter"
placeholder="请输入规格参数"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<!-- <el-form-item label="物料编码" prop="materialCode">-->
<!-- <el-input-->
<!-- v-model="queryParams.materialCode"-->
<!-- placeholder="请输入物料编码"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="物料名称" prop="materialName">-->
<!-- <el-input-->
<!-- v-model="queryParams.materialName"-->
<!-- placeholder="请输入物料名称"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="物料规格" prop="materialSpec">-->
<!-- <el-input-->
<!-- v-model="queryParams.materialSpec"-->
<!-- placeholder="请输入物料规格"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="规格参数" prop="specificationParameter">-->
<!-- <el-input-->
<!-- v-model="queryParams.specificationParameter"-->
<!-- placeholder="请输入规格参数"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<el-form-item label="常备物料" v-if="queryParams.mergeFlag===null" clearable prop="alwaysFlag">
<el-select v-model="queryParams.alwaysFlag" placeholder="请选择常备物料标识" clearable>
<el-option
v-for="dict in dict.type.mes_material_bind_flag"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<!-- <el-form-item label="常备物料" v-if="queryParams.mergeFlag===null" clearable prop="alwaysFlag">-->
<!-- <el-select v-model="queryParams.alwaysFlag" placeholder="请选择常备物料标识" clearable>-->
<!-- <el-option-->
<!-- v-for="dict in dict.type.mes_material_bind_flag"-->
<!-- :key="dict.value"-->
<!-- :label="dict.label"-->
<!-- :value="dict.value"-->
<!-- />-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<el-form-item label="可用标识" v-if="queryParams.mergeFlag!==null" prop="mergeFlag">
<el-radio-group v-model="queryParams.mergeFlag">
@ -136,6 +144,16 @@
@pagination="getList"
/>
<!-- 选择收料通知单对话框 -->
<el-dialog title="选择收料通知单信息" :visible.sync="purchaseReceiveBillOpen" append-to-body>
<select-purchase-receive-bill ref="purchaseOrderRef" v-if="purchaseReceiveBillOpen"></select-purchase-receive-bill>
<div slot="footer" class="dialog-footer">
<el-button
type="primary" @click="submitPurchaseReceiveBillForm"> </el-button>
<el-button @click="purchaseReceiveBillOpen = false"> </el-button>
</div>
</el-dialog>
</div>
</template>
@ -143,10 +161,14 @@
import {
getPurchaseOrdersWithBind
} from "@//api/mes/purchaseOrder";
import selectPurchaseReceiveBill from '@//views/mes/purchaseReceiveBill/selectPurchaseReceiveBill.vue';
export default {
name: "OrderBind",
dicts: ['active_flag', 'order_status', 'document_status','mes_material_bind_flag'],
components: {
'select-purchase-receive-bill': selectPurchaseReceiveBill,
},
props: {
defineData: {
type: Object,
@ -156,7 +178,7 @@ export default {
data() {
return {
//
loading: true,
loading: false,
//
ids: [],
//
@ -244,6 +266,7 @@ export default {
selectedRow:null,
selectedRowId:null,
isSingleSelect:true,
purchaseReceiveBillOpen:false,
ALWAYS_FLAG:{
YES:"1",
NO:"0"
@ -252,7 +275,6 @@ export default {
},
created() {
this.getData();
this.getList();
},
methods: {
getData() {
@ -272,6 +294,10 @@ export default {
/** 查询采购订单信息列表 */
getList() {
if(this.queryParams.billNo==null ||this.queryParams.billNo==='') {
this.$modal.msgWarning("请先选择收料通知单");
return;
}
this.loading = true;
getPurchaseOrdersWithBind(this.queryParams).then(response => {
response.rows.forEach(e => {
@ -338,6 +364,7 @@ export default {
},
handleSelect(row){
this.selectedRow = row;
this.selectedRow.receiveBillId = this.queryParams.receiveBillId;
this.selectedRowId = row.purchaseOrderId+"-"+row.orderBindId;
//
this.$nextTick(() => {
@ -353,6 +380,27 @@ export default {
this.multiple = !selection.length
},
handlePurchaseReceiveBill() {
this.purchaseReceiveBillOpen = true;
},
submitPurchaseReceiveBillForm() {
let selectedRow = this.$refs.purchaseOrderRef.selectedRow;
this.$set(this.queryParams, "receiveBillId", null);
this.$set(this.queryParams, "billNo", null);
this.$set(this.queryParams, "poNo", null);
this.$set(this.queryParams, "materialId", null);
this.$set(this.queryParams, "receiveBillId", selectedRow.receiveBillId);
this.$set(this.queryParams, "billNo", selectedRow.billNo);
this.$set(this.queryParams, "poNo", selectedRow.poNo);
this.$set(this.queryParams, "materialId", selectedRow.materialId);
this.getList();
this.purchaseReceiveBillOpen = false;
},
}
};
</script>

@ -0,0 +1,276 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="98px">
<el-form-item label="收料单据号" prop="billNo">
<el-input
v-model="queryParams.billNo"
placeholder="请输入收料单据号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="采购订单编号" prop="poNo">
<el-input
v-model="queryParams.poNo"
placeholder="请输入采购订单编"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="物料编码" prop="materialCode">
<el-input
v-model="queryParams.materialCode"
placeholder="请输入物料编码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="物料名称" prop="materialName">
<el-input
v-model="queryParams.materialName"
placeholder="请输入物料名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="物料规格" prop="materialSpec">
<el-input
v-model="queryParams.materialSpec"
placeholder="请输入物料规格"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="syncPurchaseReceiveBillInfos"
>同步
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="purchaseReceiveBillList" @selection-change="handleSelectionChange">
<el-table-column label="ERPID" align="center" prop="erpId" />
<el-table-column label="收料单据号" align="center" prop="billNo" />
<el-table-column label="采购订单号" align="center" prop="poNo" />
<el-table-column label="物料编码" align="center" prop="materialCode" />
<el-table-column label="物料名称" align="center" prop="materialName" />
<el-table-column label="物料规格" align="center" prop="materialSpec" />
<el-table-column label="实到数量" align="center" prop="actLandAmount" />
<el-table-column label="ERP最后修改日期" align="center" prop="erpModifyDate" width="180">
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div>
</template>
<script>
import { listPurchaseReceiveBill, getPurchaseReceiveBill, delPurchaseReceiveBill, addPurchaseReceiveBill, updatePurchaseReceiveBill } from "@/api/mes/purchaseReceiveBill";
import {runJob} from "@/api/monitor/job";
export default {
name: "PurchaseReceiveBill",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
purchaseReceiveBillList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
erpId: null,
fentryId: null,
billNo: null,
poNo: null,
documentStatus: null,
materialId: null,
materialCode: null,
materialName: null,
materialSpec:null,
fsBillId: null,
fsId: null,
actLandAmount: null,
actReceiveAmount: null,
approveDate: null,
erpModifyDate: null,
purchaseOrgId: null,
tondBase: null,
price: null,
supplierId: null,
},
//
form: {},
//
rules: {
materialCode: [
{ required: true, message: "物料编码;对应FMaterialId.FNumber不能为空", trigger: "blur" }
],
}
};
},
created() {
this.getList();
},
methods: {
/** 查询收料通知单列表 */
getList() {
this.loading = true;
listPurchaseReceiveBill(this.queryParams).then(response => {
this.purchaseReceiveBillList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
receiveBillId: null,
erpId: null,
fentryId: null,
billNo: null,
poNo: null,
documentStatus: null,
materialId: null,
materialCode: null,
materialName: null,
fsBillId: null,
fsId: null,
actLandAmount: null,
actReceiveAmount: null,
approveDate: null,
erpModifyDate: null,
purchaseOrgId: null,
tondBase: null,
price: null,
supplierId: null,
remark: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.receiveBillId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加收料通知单";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const receiveBillId = row.receiveBillId || this.ids
getPurchaseReceiveBill(receiveBillId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改收料通知单";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.receiveBillId != null) {
updatePurchaseReceiveBill(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addPurchaseReceiveBill(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const receiveBillIds = row.receiveBillId || this.ids;
this.$modal.confirm('是否确认删除收料通知单编号为"' + receiveBillIds + '"的数据项?').then(function() {
return delPurchaseReceiveBill(receiveBillIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('mes/purchaseReceiveBill/export', {
...this.queryParams
}, `purchaseReceiveBill_${new Date().getTime()}.xlsx`)
},
syncPurchaseReceiveBillInfos(){
this.$modal.confirm('确认要立即同步收料通知单信息么?').then(function() {
return runJob(211, 'DEFAULT');
}).then(() => {
this.$modal.msgSuccess("执行成功");
}).catch(() => {});
}
}
};
</script>

@ -0,0 +1,231 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="98px">
<el-form-item label="收料单据号" prop="billNo">
<el-input
v-model="queryParams.billNo"
placeholder="请输入收料单据号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="采购订单编号" prop="poNo">
<el-input
v-model="queryParams.poNo"
placeholder="请输入采购订单编"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="物料编码" prop="materialCode">
<el-input
v-model="queryParams.materialCode"
placeholder="请输入物料编码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="物料名称" prop="materialName">
<el-input
v-model="queryParams.materialName"
placeholder="请输入物料名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="物料规格" prop="materialSpec">
<el-input
v-model="queryParams.materialSpec"
placeholder="请输入物料规格"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-table v-loading="loading" :data="purchaseReceiveBillList"
@selection-change="handleSelectionChange"
:current-row-key="selectedRowId"
ref="purchaseReceiveBillRef"
>
<el-table-column label="选择" width="50">
<template slot-scope="scope">
<el-radio v-model="selectedRowId" :label="scope.row.receiveBillId" @change="handleSelect(scope.row)">
{{scope.row.i}}
</el-radio>
</template>
</el-table-column>
<el-table-column label="ERPID" align="center" prop="erpId" />
<el-table-column label="收料单据号" align="center" prop="billNo" />
<el-table-column label="采购订单号" align="center" prop="poNo" />
<el-table-column label="物料编码" align="center" prop="materialCode" />
<el-table-column label="物料名称" align="center" prop="materialName" />
<el-table-column label="物料规格" align="center" prop="materialSpec" />
<el-table-column label="实到数量" align="center" prop="actLandAmount" />
<el-table-column label="ERP最后修改日期" align="center" prop="erpModifyDate" width="180">
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div>
</template>
<script>
import { listPurchaseReceiveBill, getPurchaseReceiveBill, delPurchaseReceiveBill, addPurchaseReceiveBill, updatePurchaseReceiveBill } from "@/api/mes/purchaseReceiveBill";
export default {
name: "PurchaseReceiveBill",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
purchaseReceiveBillList: [],
selectedRows:[],
selectedRow:null,
selectedRowId:null,
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
erpId: null,
fentryId: null,
billNo: null,
poNo: null,
documentStatus: null,
materialId: null,
materialCode: null,
materialName: null,
materialSpec:null,
fsBillId: null,
fsId: null,
actLandAmount: null,
actReceiveAmount: null,
approveDate: null,
erpModifyDate: null,
purchaseOrgId: null,
tondBase: null,
price: null,
supplierId: null,
},
//
form: {},
//
rules: {
materialCode: [
{ required: true, message: "物料编码;对应FMaterialId.FNumber不能为空", trigger: "blur" }
],
}
};
},
created() {
this.getList();
},
methods: {
/** 查询收料通知单列表 */
getList() {
this.loading = true;
listPurchaseReceiveBill(this.queryParams).then(response => {
this.purchaseReceiveBillList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
receiveBillId: null,
erpId: null,
fentryId: null,
billNo: null,
poNo: null,
documentStatus: null,
materialId: null,
materialCode: null,
materialName: null,
fsBillId: null,
fsId: null,
actLandAmount: null,
actReceiveAmount: null,
approveDate: null,
erpModifyDate: null,
purchaseOrgId: null,
tondBase: null,
price: null,
supplierId: null,
remark: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.receiveBillId)
this.selectedRows = selection.map(item => item)
this.single = selection.length !== 1
this.multiple = !selection.length
},
handleSelect(row){
this.selectedRow = row;
this.selectedRowId = row.receiveBillId;
//
this.$nextTick(() => {
this.$refs.purchaseReceiveBillRef.setCurrentRow(row);
});
},
}
};
</script>

@ -1,6 +1,6 @@
<template>
<div class="app-container">
<el-form ref="form" :model="form" label-width="100px">
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-row>
<el-col :span="8" :offset="2">
<el-form-item label="任务编号" prop="taskCode">
@ -96,6 +96,28 @@
</el-col>
</el-row>
<el-row v-if="form.operationType==='0'">
<el-col :span="16" :offset="2">
<el-form-item label="人工出库" prop="manualFlag">
<el-select
v-model="form.manualFlag"
placeholder="请选择人工出库标识"
clearable
style="width: 240px"
>
<el-option
v-for="dict in dict.type.wms_product_outstock_manualflag"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row v-if="detailFlag">
<el-col :span="8" :offset="2">
<el-form-item label="审核人" prop="auditBy">
@ -157,7 +179,7 @@ import {auditProductOutstock, getProductOutstockAudit} from "@/api/wms/productou
export default {
name: "ProductoutstockDetail",
dicts: ["wms_audit_status","wms_erp_status","wms_execute_status","wms_product_outstock_task_type"],
dicts: ["wms_audit_status","wms_erp_status","wms_execute_status","wms_product_outstock_task_type","wms_product_outstock_manualflag"],
data() {
return {
//
@ -181,6 +203,11 @@ export default {
//
form: {},
//
rules: {
manualFlag: [
{ required: true, message: "人工出库标识不能为空", trigger: "change" }
],
},
detailFlag: true
};
},

Loading…
Cancel
Save