定时任务:报警和审核时定时任务发送邮件
Erp同步原材料入库、原材料出库、原材料退库、成品入库和成品出库完善
仓储部分显示页面完善
master
xs 1 month ago
parent a1ad065e6f
commit 3cadbe66ae

@ -34,4 +34,7 @@ public interface RemoteSysCommonService {
@PostMapping("/wfprocessactivity/processActivityUserInfo")
R<WfProcessActivity> selectProcessActivityUserInfo(@RequestHeader(SecurityConstants.FROM_SOURCE) String source, Long processActivityId);
@PostMapping("/pointRouter/processActivityEmailNotify")
R<?> processActivityEmailNotify(@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}

@ -56,6 +56,12 @@ public class SysPointRouter extends BaseEntity {
@Excel(name = "提示信息")
private String remark;
private Long processActivityId;
private String emailFlag;
private String sentEmailFlag;
@Override
public String getRemark() {
return remark;
@ -114,6 +120,30 @@ public class SysPointRouter extends BaseEntity {
return routerFlag;
}
public Long getProcessActivityId() {
return processActivityId;
}
public void setProcessActivityId(Long processActivityId) {
this.processActivityId = processActivityId;
}
public String getEmailFlag() {
return emailFlag;
}
public void setEmailFlag(String emailFlag) {
this.emailFlag = emailFlag;
}
public String getSentEmailFlag() {
return sentEmailFlag;
}
public void setSentEmailFlag(String sentEmailFlag) {
this.sentEmailFlag = sentEmailFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

@ -57,6 +57,11 @@ public class RemoteSysCommonFallbackFactory implements FallbackFactory<RemoteSys
return R.fail("获取工单流程步骤用户信息失败:" + throwable.getMessage());
}
@Override
public R<?> processActivityEmailNotify(String source) {
return R.fail("发送工单流程节点权限用户邮件失败:" + throwable.getMessage());
}
};
}

@ -38,4 +38,16 @@ public class SystemConstants {
public static final String SYS_ROUTER_DMS_ALARM_URL = "/dms/deviceAlarm/dmsRecordAlarmInfo";
/**
* ID
*/
public static final Long PROCESS_ACTIVITY_ID_QUALITY_CHECK_ABNORMAL = 3012L;//质检异常处理
public static final Long PROCESS_ACTIVITY_ID_PRODUCT_ORDER_OVERTIME = 2021L;//生产工单超时
public static final Long PROCESS_ACTIVITY_ID_PURCHASEORDER_OVERTIME = 2031L;//采购订单交货超时
public static final Long PROCESS_ACTIVITY_ID_SALE_ORDER_OVERTIME = 2041L;//销售订单交货超时
public static final Long PROCESS_ACTIVITY_ID_DEVICE_ALARM = 1071L;//设备报警处理
public static final Long PROCESS_ACTIVITY_ID_STOCK_NOTENOUGH = 5011L;//物料库存告警
}

@ -9,44 +9,46 @@ public class MailUtils {
public static void main(String[] args) {
// 设置发件人、收件人、SMTP服务器等信息
String senderEmail = "chencheng01@jsjyep.com";
String receiverEmail = "chencheng01@jsjyep.com";
String password = "QH6faJaWw5rgvM4u";
String host = "smtp.exmail.qq.com"; // SMTP服务器地址
int port = 465; // 端口号如果是SSL连接常用465非SSL常用587或25
// 设置邮件服务器的属性
Properties props = new Properties();
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.ssl.enable", "true"); // 启用SSL
props.put("mail.smtp.ssl.protocols", "TLSv1.2"); // 设置SSL/TLS版本
// props.put("mail.smtp.starttls.enable", "true"); // 如果是SSL连接则不需要这行
props.put("mail.smtp.host", host);
props.put("mail.smtp.port", port);
// 创建会话
Session session = Session.getInstance(props, new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(senderEmail, password);
}
});
try {
// 创建邮件消息
Message message = new MimeMessage(session);
message.setFrom(new InternetAddress(senderEmail));
message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(receiverEmail));
message.setSubject("测试");
message.setText("测试正文内容");
// String senderEmail = "chencheng01@jsjyep.com";
// String receiverEmail = "chencheng01@jsjyep.com";
// String password = "QH6faJaWw5rgvM4u";
// String host = "smtp.exmail.qq.com"; // SMTP服务器地址
// int port = 465; // 端口号如果是SSL连接常用465非SSL常用587或25
//
// // 设置邮件服务器的属性
// Properties props = new Properties();
// props.put("mail.smtp.auth", "true");
// props.put("mail.smtp.ssl.enable", "true"); // 启用SSL
// props.put("mail.smtp.ssl.protocols", "TLSv1.2"); // 设置SSL/TLS版本
//
//// props.put("mail.smtp.starttls.enable", "true"); // 如果是SSL连接则不需要这行
// props.put("mail.smtp.host", host);
// props.put("mail.smtp.port", port);
//
// // 创建会话
// Session session = Session.getInstance(props, new Authenticator() {
// protected PasswordAuthentication getPasswordAuthentication() {
// return new PasswordAuthentication(senderEmail, password);
// }
// });
//
// try {
// // 创建邮件消息
// Message message = new MimeMessage(session);
// message.setFrom(new InternetAddress(senderEmail));
// message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(receiverEmail));
// message.setSubject("测试");
// message.setText("测试正文内容");
//
// // 发送邮件
// Transport.send(message);
//// System.out.println("邮件已成功发送!");
// } catch (MessagingException e) {
// e.printStackTrace();
// throw new RuntimeException(e);
// }
// 发送邮件
Transport.send(message);
// System.out.println("邮件已成功发送!");
} catch (MessagingException e) {
e.printStackTrace();
throw new RuntimeException(e);
}
processSendEmail("ericxinstar@163.com","ddd","ddde");
}
/**
@ -57,9 +59,9 @@ public class MailUtils {
*/
public static void processSendEmail(String receiverEmail, String subject, String text) {
// 设置发件人、收件人、SMTP服务器等信息
String senderEmail = "chencheng01@jsjyep.com";
String senderEmail = "zhuangbeizhizaozhongxin@jsjyep.com";
// String receiverEmail = "chencheng01@jsjyep.com";
String password = "QH6faJaWw5rgvM4u";
String password = "Dingxl226129";
String host = "smtp.exmail.qq.com"; // SMTP服务器地址
int port = 465; // 端口号如果是SSL连接常用465非SSL常用587或25
@ -74,6 +76,12 @@ public class MailUtils {
props.put("mail.smtp.port", port);
// 创建会话
// Session session = Session.getInstance(props, new Authenticator() {
// protected PasswordAuthentication getPasswordAuthentication() {
// return new PasswordAuthentication(senderEmail, password);
// }
// });
Session session = Session.getInstance(props, new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(senderEmail, password);
@ -97,4 +105,6 @@ public class MailUtils {
}
}
}

@ -136,19 +136,21 @@ public class DmsRecordAlarmInfoServiceImpl implements IDmsRecordAlarmInfoService
List<SysPointRouter> webRouterList = new ArrayList<>();
Gson gson = new Gson();
HashMap<String, Object> map = new HashMap<>();
for (DmsRecordAlarmInfo alarmInfo : alarmInfoList) {
SysPointRouter pointRouter = new SysPointRouter();
pointRouter.setModuleCode(SystemConstants.DMS);
pointRouter.setPointType(SystemConstants.SYS_ROUTER_POINT_TYPE_ALARM);
pointRouter.setRouterAddress(SystemConstants.SYS_ROUTER_DMS_ALARM_URL);
map.put("alarmId", alarmInfo.getAlarmId());
String json = gson.toJson(map);
pointRouter.setRouterAddressDetail(json);
pointRouter.setRemark(alarmInfo.getAlarmReason());
webRouterList.add(pointRouter);
}
//WEB通知
remoteSysCommonService.insertSysPointRouterPort(webRouterList, SecurityConstants.INNER);
//trigger写此逻辑
// for (DmsRecordAlarmInfo alarmInfo : alarmInfoList) {
// SysPointRouter pointRouter = new SysPointRouter();
// pointRouter.setModuleCode(SystemConstants.DMS);
// pointRouter.setPointType(SystemConstants.SYS_ROUTER_POINT_TYPE_ALARM);
// pointRouter.setRouterAddress(SystemConstants.SYS_ROUTER_DMS_ALARM_URL);
// pointRouter.setProcessActivityId(SystemConstants.PROCESS_ACTIVITY_ID_QUALITY_CHECK_ABNORMAL);
// map.put("alarmId", alarmInfo.getAlarmId());
// String json = gson.toJson(map);
// pointRouter.setRouterAddressDetail(json);
// pointRouter.setRemark(alarmInfo.getAlarmReason());
// webRouterList.add(pointRouter);
// }
// //WEB通知
// remoteSysCommonService.insertSysPointRouterPort(webRouterList, SecurityConstants.INNER);
for (DmsRecordAlarmInfo alarmInfo : alarmInfoList) {
DmsRecordAlarmInfo recordAlarmInfo = new DmsRecordAlarmInfo();
recordAlarmInfo.setAlarmId(alarmInfo.getAlarmId());

@ -151,6 +151,8 @@ public class MesPurchaseOrder extends BaseEntity {
*/
private String specificationParameter;
private BigDecimal price;
public String getSpecificationParameter() {
return specificationParameter;
}
@ -367,6 +369,14 @@ public class MesPurchaseOrder extends BaseEntity {
return isFlag;
}
public BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

@ -929,7 +929,7 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
JSONObject queryJson = new JSONObject();
String formId = "PUR_PurchaseOrder";
String fieldKeys = "FID,FBillNo,FApproveDate,FDocumentStatus,FPOOrderEntry_FEntryID,FRequireDeptId,FMaterialId,FMaterialId.FNumber,FMaterialId.FName," +
"FQty,FDeliveryDate,FCreateDate,FModifyDate,FUnitId,FStockUnitID,FPriceUnitID,FAuxPropId,FAUXPROPID.FF100001,FSrcBillNo,FPurchaseOrgId,FPurchaseDeptId,F_TOND_Base,FSupplierId";
"FQty,FDeliveryDate,FCreateDate,FModifyDate,FUnitId,FStockUnitID,FPriceUnitID,FPrice,FAuxPropId,FAUXPROPID.FF100001,FSrcBillNo,FPurchaseOrgId,FPurchaseDeptId,F_TOND_Base,FSupplierId";
// String filterString = "";
String orderString = "";
int topRowCount = 0;
@ -1006,6 +1006,8 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
Long stockUnitId = resultObject.getLong("FStockUnitID");
//计价单位
Long priceUnitId = resultObject.getLong("FPriceUnitID");
//单价
BigDecimal price = resultObject.getBigDecimal("FPrice");
//辅助属性
Long auxPropId = resultObject.getLong("FAuxPropId");
//规格参数
@ -1035,6 +1037,7 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
mesPurchaseOrder.setUnitId(unitId);
mesPurchaseOrder.setStockUnitId(stockUnitId);
mesPurchaseOrder.setPriceUnitId(priceUnitId);
mesPurchaseOrder.setPrice(price);
mesPurchaseOrder.setAuxPropId(auxPropId);
mesPurchaseOrder.setSpecificationParameter(FF100001);
mesPurchaseOrder.setSrcBillNo(srcBillNo);

@ -7,6 +7,7 @@ import com.hw.ems.api.RemoteEmsService;
import com.hw.jindie.api.RemoteJindieService;
import com.hw.jindie.api.domain.vo.ErpSyncInfoVo;
import com.hw.mes.api.RemoteMesService;
import com.hw.system.api.RemoteSysCommonService;
import com.hw.wms.api.RemoteWmsService;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
@ -33,6 +34,8 @@ public class RyTask
private RemoteWmsService remoteWmsService;
@Autowired
private RemoteMesService remoteMesService;
@Autowired
private RemoteSysCommonService remoteSysCommonService;
public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i)
{
@ -127,28 +130,28 @@ public class RyTask
}
public void syncInventoryInformationToERP(){
System.out.println("++定时同步原材料入库信息给ERP++syncInventoryInformationToERP");
System.out.println(new Date()+"++定时同步原材料入库信息给ERP++syncInventoryInformationToERP");
remoteWmsService.synchronizeInventoryInformationToERP(SecurityConstants.INNER);
}
public void syncRawMaterialDeliveryInformationToERP(){
System.out.println("++定时同步原材料出库信息给ERP++syncRawMaterialDeliveryInformationToERP");
System.out.println(new Date()+"++定时同步原材料出库信息给ERP++syncRawMaterialDeliveryInformationToERP");
remoteWmsService.synchronizeRawMaterialDeliveryInformationToERP(SecurityConstants.INNER);
}
public void synchronizeRawReturnInformationToERP(){
System.out.println("++定时同步原材料退库信息给ERP++syncRawMaterialDeliveryInformationToERP");
System.out.println(new Date()+"++定时同步原材料退库信息给ERP++syncRawMaterialDeliveryInformationToERP");
remoteWmsService.synchronizeRawReturnInformationToERP(SecurityConstants.INNER);
}
public void synchronizeProductInstockInformationToERP(Integer days){
System.out.println("++定时同步成品入库信息给ERP++synchronizeProductInstockInformationToERP");
System.out.println(new Date()+"++定时同步成品入库信息给ERP++synchronizeProductInstockInformationToERP");
remoteWmsService.synchronizeProductInstockInformationToERP(days, SecurityConstants.INNER);
}
public void synchronizeProductOutstockInformationToERP(Integer days){
System.out.println("++定时同步成品出库信息给ERP++synchronizeProductOutstockInformationToERP");
System.out.println(new Date()+"++定时同步成品出库信息给ERP++synchronizeProductOutstockInformationToERP");
remoteWmsService.synchronizeProductOutstockInformationToERP(days, SecurityConstants.INNER);
}
@ -176,4 +179,12 @@ public class RyTask
public void generateProduceStatisticsDetail(){
remoteMesService.generateProduceStatisticsDetail(SecurityConstants.INNER);
}
/**
* syspointrouter
*/
public void processActivityEmailNotify(){
remoteSysCommonService.processActivityEmailNotify(SecurityConstants.INNER);
}
}

@ -239,6 +239,7 @@ public class MesBaseMaterialInfoServiceImpl implements IMesBaseMaterialInfoServi
routerAddressDetailJson.put("alarmInfoId", alarmInfoId);
sysPointRouter.setRouterAddressDetail(routerAddressDetailJson.toString());
sysPointRouter.setRemark("库存不足报警");
sysPointRouter.setProcessActivityId(SystemConstants.PROCESS_ACTIVITY_ID_STOCK_NOTENOUGH);
sysPointRouter.setCreateBy(nickName);
sysPointRouter.setCreateTime(currentDate);
return sysPointRouter;

@ -673,6 +673,7 @@ public class MesProductOrderServiceImpl implements IMesProductOrderService {
sysPointRouter.setModuleCode("MES");
sysPointRouter.setPointType(SystemConstants.SYS_ROUTER_POINT_TYPE_ALARM);
sysPointRouter.setRouterAddress("/mes/plan/productOrder");
sysPointRouter.setProcessActivityId(SystemConstants.PROCESS_ACTIVITY_ID_PRODUCT_ORDER_OVERTIME);
if(productOrderId!=null){
JSONObject routerAddressDetailJson = new JSONObject();
routerAddressDetailJson.put("productOrderId", productOrderId);

@ -656,6 +656,7 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService {
sysPointRouter.setModuleCode("MES");
sysPointRouter.setPointType(SystemConstants.SYS_ROUTER_POINT_TYPE_ALARM);
sysPointRouter.setRouterAddress("/mes/plan/purchaseOrder");
sysPointRouter.setProcessActivityId(SystemConstants.PROCESS_ACTIVITY_ID_PURCHASEORDER_OVERTIME);
if(purchaseOrderId!=null){
JSONObject routerAddressDetailJson = new JSONObject();
routerAddressDetailJson.put("purchaseOrderId", purchaseOrderId);

@ -374,6 +374,7 @@ public class MesSaleOrderServiceImpl implements IMesSaleOrderService {
sysPointRouter.setModuleCode("MES");
sysPointRouter.setPointType(SystemConstants.SYS_ROUTER_POINT_TYPE_ALARM);
sysPointRouter.setRouterAddress("/mes/plan/saleOrder");
sysPointRouter.setProcessActivityId(SystemConstants.PROCESS_ACTIVITY_ID_SALE_ORDER_OVERTIME);
if (saleOrderId != null) {
JSONObject routerAddressDetailJson = new JSONObject();
routerAddressDetailJson.put("saleOrderId", saleOrderId);

@ -113,4 +113,13 @@ public class SysPointRouterController extends BaseController {
}
/**
* syspointrouter
*/
@PostMapping(("/processActivityEmailNotify"))
public AjaxResult processActivityEmailNotify() {
return toAjax(sysPointRouterService.processActivityEmailNotify());
}
}

@ -58,4 +58,14 @@ public interface SysPointRouterMapper
* @return
*/
public int deleteSysPointRouterByPointRouterIds(Long[] pointRouterIds);
/**
* ,使
*
* @param sysPointRouter
* @return
*/
public List<SysPointRouter> selectEmailNotifySysPointRouterList(SysPointRouter sysPointRouter);
}

@ -65,4 +65,9 @@ public interface ISysPointRouterService
* @return
*/
public int insertSysPointRouterList(List<SysPointRouter> sysPointRouterList);
/**
* Email
*/
public int processActivityEmailNotify();
}

@ -1,9 +1,18 @@
package com.hw.system.common.service.impl;
import java.rmi.ServerException;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
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.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.stereotype.Service;
import com.hw.system.common.mapper.SysPointRouterMapper;
@ -22,6 +31,9 @@ public class SysPointRouterServiceImpl implements ISysPointRouterService {
@Autowired
private SysPointRouterMapper sysPointRouterMapper;
@Autowired
private SysUserMapper sysUserMapper;
/**
*
*
@ -92,6 +104,7 @@ public class SysPointRouterServiceImpl implements ISysPointRouterService {
/**
* List
*
* @param sysPointRouterList
* @return
*/
@ -104,4 +117,38 @@ public class SysPointRouterServiceImpl implements ISysPointRouterService {
return 1;
}
/**
* Email
*/
@Override
public int processActivityEmailNotify() {
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));
for (Long processActivityId : sysPointRouterMap.keySet()) {
List<SysPointRouter> sysPointRoutersByActivityList = sysPointRouterMap.get(processActivityId);
List<SysUser> sysUsers = sysUserMapper.selectProcessActivityAuthUserList(processActivityId);
String sendMsg = "";
for (SysPointRouter sysPointRouter : sysPointRoutersByActivityList) {
sendMsg += sysPointRouter.getRemark() + ";";
sysPointRouter.setSentEmailFlag("1");
sysPointRouter.setUpdateTime(new Date());
// sysPointRouter.setUpdateBy(SecurityUtils.getLoginUser().getNickname());
sysPointRouterMapper.updateSysPointRouter(sysPointRouter);
}
for (SysUser sysUser : sysUsers) {
if (StringUtils.isNotEmpty(sysUser.getEmail())) {
MailUtils.processSendEmail(sysUser.getEmail(), "通知", sendMsg);
}
}
}
return 1;
}
}

@ -129,4 +129,13 @@ public interface SysUserMapper
public List<SysUser> selectnoperList(SysUser user);
/**
* ID
* @param user
* @return
*/
public List<SysUser> selectProcessActivityAuthUserList(Long processActivityId);
}

@ -235,4 +235,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="nickName != null">and u.nick_name like concat('%', #{nickName} ,'%')</if>
${params.dataScope}
</select>
<select id="selectProcessActivityAuthUserList" parameterType="SysUser" resultMap="SysUserResult">
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber,
u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark from sys_user u
where u.del_flag = '0' and exists (select 1 from wf_process_activity_auth wpau where wpau.auth_target_id = u.user_id AND wpau.process_activity_id = #{processActivityId})
</select>
</mapper>

@ -16,6 +16,9 @@
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="processActivityId" column="process_activity_id"/>
<result property="emailFlag" column="email_flag"/>
<result property="sentEmailFlag" column="sent_email_flag"/>
</resultMap>
<sql id="selectSysPointRouterVo">
@ -29,7 +32,8 @@
create_by,
create_time,
update_by,
update_time
update_time,
process_activity_id
from sys_point_router
</sql>
@ -68,6 +72,7 @@
<if test="routerAddressDetail != null">router_address_detail,</if>
<if test="routerFlag != null">router_flag,</if>
<if test="remark != null">remark,</if>
<if test="processActivityId != null">process_activity_id,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
@ -80,6 +85,7 @@
<if test="routerAddressDetail != null">#{routerAddressDetail},</if>
<if test="routerFlag != null">#{routerFlag},</if>
<if test="remark != null">#{remark},</if>
<if test="processActivityId != null">#{processActivityId},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
@ -96,6 +102,8 @@
<if test="routerAddressDetail != null">router_address_detail = #{routerAddressDetail},</if>
<if test="routerFlag != null">router_flag = #{routerFlag},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="emailFlag != null">email_flag = #{emailFlag},</if>
<if test="sentEmailFlag != null">sent_email_flag = #{sentEmailFlag},</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>
@ -116,4 +124,16 @@
#{pointRouterId}
</foreach>
</delete>
<select id="selectEmailNotifySysPointRouterList" parameterType="SysPointRouter" resultMap="SysPointRouterResult">
<include refid="selectSysPointRouterVo"/>
<where>
email_flag ='1' and sent_email_flag = '0'
</where>
order by create_time desc
</select>
</mapper>

@ -250,7 +250,7 @@ public class WmsApiController extends BaseController {
}
/**
* ERP
* ERPrawoutstockdetailERP
*
* @return
*/

@ -125,6 +125,8 @@ public class WmsRawInstock extends BaseEntity
private String materialName;
private String materialSpec;
/** 计量单位编号 */
private String unitCode;
@ -401,6 +403,14 @@ public class WmsRawInstock extends BaseEntity
this.materialName = materialName;
}
public String getMaterialSpec() {
return materialSpec;
}
public void setMaterialSpec(String materialSpec) {
this.materialSpec = materialSpec;
}
public String getSrcBillNo() {
return srcBillNo;
}

@ -90,6 +90,10 @@ public class WmsRawOutstockDetail extends BaseEntity {
@Excel(name = "同步ERP状态(0:失败,1成功)")
private String erpStatus;
/** 同步给ERP的数量 */
@Excel(name = "同步给ERP的数量")
private BigDecimal erpAmount;
/**
*
*/
@ -146,6 +150,10 @@ public class WmsRawOutstockDetail extends BaseEntity {
private String materialName;
private String materialSpec;
private String barcodeSpec;
private String applyBy;
private Date applyDate;
@ -162,6 +170,17 @@ public class WmsRawOutstockDetail extends BaseEntity {
/**仓库总库存信息ID*/
private Long stockTotalId;
private String taskTypeStr;
/** 单价 */
private BigDecimal price;
/** 规格参数 */
private String specificationParameter;
/** 计量单位编号 */
private String unitCode;
public void setRawOutstockDetailId(Long rawOutstockDetailId) {
this.rawOutstockDetailId = rawOutstockDetailId;
@ -259,6 +278,14 @@ public class WmsRawOutstockDetail extends BaseEntity {
return erpStatus;
}
public BigDecimal getErpAmount() {
return erpAmount;
}
public void setErpAmount(BigDecimal erpAmount) {
this.erpAmount = erpAmount;
}
public void setOutstockPerson(String outstockPerson) {
this.outstockPerson = outstockPerson;
}
@ -339,6 +366,22 @@ public class WmsRawOutstockDetail extends BaseEntity {
this.materialName = materialName;
}
public String getMaterialSpec() {
return materialSpec;
}
public void setMaterialSpec(String materialSpec) {
this.materialSpec = materialSpec;
}
public String getBarcodeSpec() {
return barcodeSpec;
}
public void setBarcodeSpec(String barcodeSpec) {
this.barcodeSpec = barcodeSpec;
}
public String getApplyBy() {
return applyBy;
}
@ -403,6 +446,38 @@ public class WmsRawOutstockDetail extends BaseEntity {
this.stockTotalId = stockTotalId;
}
public String getTaskTypeStr() {
return taskTypeStr;
}
public void setTaskTypeStr(String taskTypeStr) {
this.taskTypeStr = taskTypeStr;
}
public BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
public String getSpecificationParameter() {
return specificationParameter;
}
public void setSpecificationParameter(String specificationParameter) {
this.specificationParameter = specificationParameter;
}
public String getUnitCode() {
return unitCode;
}
public void setUnitCode(String unitCode) {
this.unitCode = unitCode;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

@ -105,6 +105,8 @@ public class WmsRawReturnDetail extends BaseEntity
private String materialSpec;
private String barcodeSpec;
private String applyBy;
private String taskType;
@ -321,6 +323,14 @@ public class WmsRawReturnDetail extends BaseEntity
this.materialSpec = materialSpec;
}
public String getBarcodeSpec() {
return barcodeSpec;
}
public void setBarcodeSpec(String barcodeSpec) {
this.barcodeSpec = barcodeSpec;
}
public String getApplyBy() {
return applyBy;
}

@ -92,4 +92,12 @@ public interface WmsRawOutstockDetailMapper {
public int selectCountOfWmsRawOutstockDetail(WmsRawOutstockDetail wmsRawOutstockDetail);
/**
* ERPdetailList
*
* @param wmsRawOutstockDetail
* @return
*/
public List<WmsRawOutstockDetail> selectWmsRawOutstockDetailERPNotSynchronized(WmsRawOutstockDetail wmsRawOutstockDetail);
}

@ -44,6 +44,9 @@ public class WmsErpScheduledTaskServiceImpl implements IWmsErpScheduledTaskServi
@Autowired
private WmsRawOutstockMapper wmsRawOutstockMapper;
@Autowired
private WmsRawOutstockDetailMapper wmsRawOutstockDetailMapper;
@Autowired
private WmsProductInstockMapper wmsProductInstockMapper;
@ -71,7 +74,7 @@ public class WmsErpScheduledTaskServiceImpl implements IWmsErpScheduledTaskServi
* @return
*/
@Override
// @Transactional
@Transactional
public int synchronizeInventoryInformationToERP() {
WmsRawInstock wmsRawInstock = new WmsRawInstock();
int result = 0;
@ -105,9 +108,24 @@ public class WmsErpScheduledTaskServiceImpl implements IWmsErpScheduledTaskServi
rawInstock.setUpdateDate(DateUtils.getNowDate());
wmsRawInstockMapper.updateWmsRawInstock(rawInstock);
}
data.put("FDate", DateUtils.getTime());
String fdate = DateUtils.getTime();
if (instock.getApplyDate() != null) {
fdate = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, instock.getApplyDate());
}
String specificationParameter = instock.getSpecificationParameter();
if(StringUtils.isEmpty(specificationParameter)){
specificationParameter = instock.getMaterialSpec();
}
if(StringUtils.isEmpty(specificationParameter)){
specificationParameter = "无";
}
data.put("FDate", fdate);
data.put("FMaterialId", instock.getMaterialCode());
data.put("FAuxPropId", instock.getSpecificationParameter());
data.put("FAuxPropId", specificationParameter);
data.put("FSrcBillNo", instock.getSrcBillNo());
data.put("FUnitID", instock.getUnitCode());
data.put("FRealQty", FRealQty);
@ -115,17 +133,23 @@ public class WmsErpScheduledTaskServiceImpl implements IWmsErpScheduledTaskServi
data.put("FSupplierCode", supplierCode);
data.put("FTondBase", projectNo);
String params = data.toJSONString();
R<AjaxResult> paramsResult = remoteJindieService.savePurchaseStorage(params, SecurityConstants.INNER);
String paramsResultData = paramsResult.getMsg();
JSONObject jsonObject = JSONObject.parseObject(paramsResultData);
Boolean isSuccess = (Boolean) jsonObject.get("IsSuccess");
if (isSuccess) {
result++;
log.info("synchronizeInventoryInformationToERP同步原材料入库成功:" + paramsResult.toString());
} else {
log.error("synchronizeInventoryInformationToERP同步原材料入库失败:" + paramsResult.toString());
throw new ServiceException("同步原材料入库失败" + paramsResult.toString());
try {
R<AjaxResult> paramsResult = remoteJindieService.savePurchaseStorage(params, SecurityConstants.INNER);
String paramsResultData = paramsResult.getMsg();
JSONObject jsonObject = JSONObject.parseObject(paramsResultData);
Boolean isSuccess = (Boolean) jsonObject.get("IsSuccess");
if (isSuccess) {
result++;
log.info("synchronizeInventoryInformationToERP同步原材料入库成功:" + paramsResult.toString());
} else {
log.error("synchronizeInventoryInformationToERP同步原材料入库失败:" + paramsResult.toString());
throw new RuntimeException("同步原材料入库失败" + paramsResult.toString());
}
} catch (Exception e) {
log.error("同步原材料入库失败" + e.getMessage());
throw new RuntimeException("同步原材料入库失败" + e.getMessage());
}
}
/**
@ -134,21 +158,24 @@ public class WmsErpScheduledTaskServiceImpl implements IWmsErpScheduledTaskServi
* @return
*/
@Override
@Transactional
public int synchronizeRawMaterialDeliveryInformationToERP() {
int result = 0;
WmsRawOutstock otherRawOutstock = new WmsRawOutstock();
otherRawOutstock.setTaskTypeStr(WmsConstants.WMS_RAW_OUTSTOCK_TASK_TYPE_PRODUCTION_PICKING + "," + WmsConstants.WMS_RAW_OUTSTOCK_TASK_TYPE_PRODUCTION_INSTALL
+ "," + WmsConstants.WMS_RAW_OUTSTOCK_TASK_TYPE_OTHER);
List<WmsRawOutstock> otherRawOutstockList = wmsRawOutstockMapper.selectWmsRawOutstockERPNotSynchronized(otherRawOutstock);
Map<Long, List<WmsRawOutstock>> otherMaterialIdMap = otherRawOutstockList.stream().collect(Collectors.groupingBy(WmsRawOutstock::getMaterialId));
//领料
WmsRawOutstockDetail otherRawOutstockDetail = new WmsRawOutstockDetail();
otherRawOutstockDetail.setTaskTypeStr(WmsConstants.WMS_RAW_OUTSTOCK_TASK_TYPE_PRODUCTION_PICKING + "," + WmsConstants.WMS_RAW_OUTSTOCK_TASK_TYPE_PRODUCTION_INSTALL
+ "," + WmsConstants.WMS_RAW_OUTSTOCK_TASK_TYPE_AUTO_OUTSTOCK + "," + WmsConstants.WMS_RAW_OUTSTOCK_TASK_TYPE_OTHER);
List<WmsRawOutstockDetail> otherRawOutstockDetailList = wmsRawOutstockDetailMapper.selectWmsRawOutstockDetailERPNotSynchronized(otherRawOutstockDetail);
Map<Long, List<WmsRawOutstockDetail>> otherMaterialIdMap = otherRawOutstockDetailList.stream().collect(Collectors.groupingBy(WmsRawOutstockDetail::getMaterialId));
for (Long materialId : otherMaterialIdMap.keySet()) {
result += syncOutstockInformation(otherMaterialIdMap, materialId, "");
}
WmsRawOutstock returnRawOutstock = new WmsRawOutstock();
returnRawOutstock.setTaskType(WmsConstants.WMS_RAW_OUTSTOCK_TASK_TYPE_RETURN_OUTSTOCK);
List<WmsRawOutstock> returnOutstockList = wmsRawOutstockMapper.selectWmsRawOutstockERPNotSynchronized(returnRawOutstock);
Map<Long, List<WmsRawOutstock>> returnMaterialIdMap = returnOutstockList.stream().collect(Collectors.groupingBy(WmsRawOutstock::getMaterialId));
//退货出库
WmsRawOutstockDetail returnRawOutstockDetail = new WmsRawOutstockDetail();
returnRawOutstockDetail.setTaskType(WmsConstants.WMS_RAW_OUTSTOCK_TASK_TYPE_RETURN_OUTSTOCK);
List<WmsRawOutstockDetail> returnRawOutstockDetailList = wmsRawOutstockDetailMapper.selectWmsRawOutstockDetailERPNotSynchronized(returnRawOutstockDetail);
Map<Long, List<WmsRawOutstockDetail>> returnMaterialIdMap = returnRawOutstockDetailList.stream().collect(Collectors.groupingBy(WmsRawOutstockDetail::getMaterialId));
for (Long materialId : returnMaterialIdMap.keySet()) {
result += syncOutstockInformation(returnMaterialIdMap, materialId, WmsConstants.WMS_RAW_OUTSTOCK_TASK_TYPE_RETURN_OUTSTOCK);
}
@ -162,7 +189,7 @@ public class WmsErpScheduledTaskServiceImpl implements IWmsErpScheduledTaskServi
* @return
*/
@Override
// @Transactional
@Transactional
public int synchronizeRawReturnInformationToERP() {
WmsRawReturnDetail wmsRawReturnDetail = new WmsRawReturnDetail();
int result = 0;
@ -191,25 +218,35 @@ public class WmsErpScheduledTaskServiceImpl implements IWmsErpScheduledTaskServi
JSONObject data = new JSONObject();
double FRealQty = wmsRawReturnDetaiList.stream().mapToDouble(item -> item.getReturnAmount().subtract(item.getErpAmount()).doubleValue()).sum();
WmsRawReturnDetail rawReturnDetail = wmsRawReturnDetaiList.get(0);
String specificationParameter = StringUtils.isNotEmpty(mesPurchaseOrder.getSpecificationParameter()) ? mesPurchaseOrder.getSpecificationParameter() : rawReturnDetail.getMaterialSpec();
if (StringUtils.isNotEmpty(specificationParameter)) {
for (WmsRawReturnDetail wmsRawReturnDetail : wmsRawReturnDetaiList) {
wmsRawReturnDetail.setErpStatus("1");//同步ERP状态(0:失败,1成功)
wmsRawReturnDetail.setErpAmount(wmsRawReturnDetail.getReturnAmount());
wmsRawReturnDetail.setUpdateDate(DateUtils.getNowDate());
wmsRawReturnDetailMapper.updateWmsRawReturnDetail(wmsRawReturnDetail);
}
data.put("FDate", DateUtils.getTime());
data.put("FMaterialId", rawReturnDetail.getMaterialCode());
data.put("FAuxPropId", specificationParameter);
data.put("FSrcBillNo", srcBillNo);
data.put("FUnitID", rawReturnDetail.getUnitCode());
data.put("FRealQty", FRealQty);
data.put("FStockId", wmsConfig.getfStockId());
data.put("FSupplierCode", supplierCode);
data.put("FTondBase", projectNo);
String params = data.toJSONString();
String specificationParameter = StringUtils.isNotEmpty(mesPurchaseOrder.getSpecificationParameter()) ?
mesPurchaseOrder.getSpecificationParameter() : rawReturnDetail.getMaterialSpec();
if (StringUtils.isEmpty(specificationParameter)) {
specificationParameter = "无";
}
for (WmsRawReturnDetail wmsRawReturnDetail : wmsRawReturnDetaiList) {
wmsRawReturnDetail.setErpStatus("1");//同步ERP状态(0:失败,1成功)
wmsRawReturnDetail.setErpAmount(wmsRawReturnDetail.getReturnAmount());
wmsRawReturnDetail.setUpdateDate(DateUtils.getNowDate());
wmsRawReturnDetailMapper.updateWmsRawReturnDetail(wmsRawReturnDetail);
}
String fdate = DateUtils.getTime();
if (rawReturnDetail.getReturnTime() != null) {
fdate = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, rawReturnDetail.getReturnTime());
}
data.put("FDate", fdate);
data.put("FMaterialId", rawReturnDetail.getMaterialCode());
data.put("FAuxPropId", specificationParameter);
data.put("FSrcBillNo", srcBillNo);
data.put("FUnitID", rawReturnDetail.getUnitCode());
data.put("FRealQty", FRealQty);
data.put("FStockId", wmsConfig.getfStockId());
data.put("FSupplierCode", supplierCode);
data.put("FTondBase", projectNo);
String params = data.toJSONString();
try {
R<AjaxResult> paramsResult = remoteJindieService.savePurchaseStorage(params, SecurityConstants.INNER);
String paramsResultData = paramsResult.getMsg();
JSONObject jsonObject = JSONObject.parseObject(paramsResultData);
@ -221,27 +258,31 @@ public class WmsErpScheduledTaskServiceImpl implements IWmsErpScheduledTaskServi
log.error("synchronizeInventoryInformationToERP同步原材料退库失败:" + paramsResult.toString());
throw new ServiceException("同步原材料入库失败" + paramsResult.toString());
}
} catch (Exception e) {
log.error("synchronizeInventoryInformationToERP同步原材料退库失败:" + e.getMessage());
throw new ServiceException("同步原材料入库失败" + e.getMessage());
}
}
}
@Transactional(propagation = Propagation.REQUIRES_NEW)
public int syncOutstockInformation(Map<Long, List<WmsRawOutstock>> materialIdMap, Long materialId, String taskType) {
public int syncOutstockInformation(Map<Long, List<WmsRawOutstockDetail>> materialIdMap, Long materialId, String taskType) {
int result = 0;
List<WmsRawOutstock> wmsRawOutstockList = materialIdMap.get(materialId);
List<WmsRawOutstockDetail> wmsRawOutstockDetailList = materialIdMap.get(materialId);
JSONObject data = new JSONObject();
double FRealQty = wmsRawOutstockList.stream().mapToDouble(item -> item.getRealOutstockAmount().subtract(item.getErpAmount()).doubleValue()).sum();
WmsRawOutstock outstock = wmsRawOutstockList.get(0);
for (WmsRawOutstock wmsRawOutstock : wmsRawOutstockList) {
if (wmsRawOutstock.getRealOutstockAmount().equals(wmsRawOutstock.getOutstockAmount())) {
wmsRawOutstock.setErpStatus("1");//同步ERP状态(0:失败,1成功,2同步中)
double FRealQty = wmsRawOutstockDetailList.stream().mapToDouble(item -> item.getOutstockAmount().subtract(item.getErpAmount()).doubleValue()).sum();
WmsRawOutstockDetail outstockDetail = wmsRawOutstockDetailList.get(0);
for (WmsRawOutstockDetail wmsRawOutstockDetail : wmsRawOutstockDetailList) {
if (wmsRawOutstockDetail.getPlanAmount().equals(wmsRawOutstockDetail.getOutstockAmount())) {
wmsRawOutstockDetail.setErpStatus("1");//同步ERP状态(0:失败,1成功,2同步中)
} else {
wmsRawOutstock.setErpStatus("2");//同步ERP状态(0:失败,1成功,2同步中)
wmsRawOutstockDetail.setErpStatus("2");//同步ERP状态(0:失败,1成功,2同步中)
}
wmsRawOutstock.setErpAmount(wmsRawOutstock.getRealOutstockAmount());
wmsRawOutstock.setUpdateDate(DateUtils.getNowDate());
wmsRawOutstockMapper.updateWmsRawOutstock(wmsRawOutstock);
wmsRawOutstockDetail.setErpAmount(wmsRawOutstockDetail.getOutstockAmount());
wmsRawOutstockDetail.setUpdateDate(DateUtils.getNowDate());
wmsRawOutstockDetailMapper.updateWmsRawOutstockDetail(wmsRawOutstockDetail);
}
if (StringUtils.isNotEmpty(taskType) && taskType.equals(WmsConstants.WMS_RAW_OUTSTOCK_TASK_TYPE_RETURN_OUTSTOCK)) {
@ -251,27 +292,48 @@ public class WmsErpScheduledTaskServiceImpl implements IWmsErpScheduledTaskServi
}
// model.put("F_TOND_Combo", "一般领料"); //领料类型(必填项)
data.put("FDate", DateUtils.getTime());
data.put("FMaterialId", outstock.getMaterialCode());
data.put("FAuxPropId", outstock.getSpecificationParameter() == null ? "" : outstock.getSpecificationParameter());
data.put("FUnitID", outstock.getUnitCode());
String fdate = DateUtils.getTime();
if (outstockDetail.getOutstockTime() != null) {
fdate = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, outstockDetail.getOutstockTime());
}
String barcodeSpec = outstockDetail.getBarcodeSpec();
String materialSpec = outstockDetail.getMaterialSpec();
if(StringUtils.isEmpty(barcodeSpec)){
if(StringUtils.isNotEmpty(materialSpec)){
barcodeSpec = materialSpec;
}else{
barcodeSpec = "无";
}
}
data.put("FDate", fdate);
data.put("FMaterialId", outstockDetail.getMaterialCode());
data.put("FAuxPropId", barcodeSpec);
data.put("FUnitID", outstockDetail.getUnitCode());
data.put("FQty", FRealQty);
data.put("FPrice", outstock.getPrice());
data.put("FPrice", outstockDetail.getPrice());
data.put("FStockId", wmsConfig.getfStockId());
String params = data.toJSONString();
R<AjaxResult> paramsResult = remoteJindieService.saveOtherOutStorage(params, SecurityConstants.INNER);
String paramsResultData = paramsResult.getMsg();
JSONObject jsonObject = JSONObject.parseObject(paramsResultData);
Boolean isSuccess = (Boolean) jsonObject.get("IsSuccess");
if (isSuccess) {
result++;
log.info("synchronizeRawMaterialDeliveryInformationToERP成功:" + paramsResult.toString());
} else {
log.error("synchronizeRawMaterialDeliveryInformationToERP失败:" + paramsResult.toString());
throw new RuntimeException("synchronizeRawMaterialDeliveryInformationToERP失败:" + paramsResult.toString());
try {
R<AjaxResult> paramsResult = remoteJindieService.saveOtherOutStorage(params, SecurityConstants.INNER);
String paramsResultData = paramsResult.getMsg();
JSONObject jsonObject = JSONObject.parseObject(paramsResultData);
Boolean isSuccess = (Boolean) jsonObject.get("IsSuccess");
if (isSuccess) {
result++;
log.info("synchronizeRawMaterialDeliveryInformationToERP成功:" + paramsResult.toString());
} else {
log.error("synchronizeRawMaterialDeliveryInformationToERP失败:" + paramsResult.toString());
throw new RuntimeException("synchronizeRawMaterialDeliveryInformationToERP失败:" + paramsResult.toString());
}
return result;
} catch (Exception e) {
log.error("synchronizeRawMaterialDeliveryInformationToERP失败:" + e.getMessage());
throw new RuntimeException("synchronizeRawMaterialDeliveryInformationToERP失败:" + e.getMessage());
}
return result;
}
/**
@ -311,24 +373,41 @@ public class WmsErpScheduledTaskServiceImpl implements IWmsErpScheduledTaskServi
wmsProductInstockMapper.updateWmsProductInstock(wmsProductInstock);
}
data.put("FDate", DateUtils.getTime());
String fdate = DateUtils.getTime();
if (instock.getApplyDate() != null) {
fdate = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, instock.getApplyDate());
}
String specificationParameter = StringUtils.isNotEmpty(instock.getSpecificationParameter()) ?
instock.getSpecificationParameter() : instock.getMaterialSpec();
if (StringUtils.isEmpty(specificationParameter)) {
specificationParameter = "无";
}
data.put("FDate", fdate);
data.put("FMaterialId", instock.getMaterialCode());
data.put("FAuxPropId", instock.getSpecificationParameter() == null ? "B" : instock.getSpecificationParameter());
data.put("FAuxPropId", specificationParameter);
data.put("FUnitID", instock.getUnitCode());
data.put("FQty", FRealQty);
data.put("FPrice", instock.getPrice());
data.put("FStockId", wmsConfig.getfStockId());
String params = data.toJSONString();
R<AjaxResult> paramsResult = remoteJindieService.saveOtherInStorage(params, SecurityConstants.INNER);
String paramsResultData = paramsResult.getMsg();
JSONObject jsonObject = JSONObject.parseObject(paramsResultData);
Boolean isSuccess = (Boolean) jsonObject.get("IsSuccess");
if (isSuccess) {
result++;
log.info("synchronizeProductInstockInformationToERP成功:" + paramsResult.toString());
} else {
log.error("synchronizeProductInstockInformationToERP失败:" + paramsResult.toString());
throw new RuntimeException("synchronizeProductInstockInformationToERP失败:" + paramsResult.toString());
try {
R<AjaxResult> paramsResult = remoteJindieService.saveOtherInStorage(params, SecurityConstants.INNER);
String paramsResultData = paramsResult.getMsg();
JSONObject jsonObject = JSONObject.parseObject(paramsResultData);
Boolean isSuccess = (Boolean) jsonObject.get("IsSuccess");
if (isSuccess) {
result++;
log.info("synchronizeProductInstockInformationToERP成功:" + paramsResult.toString());
} else {
log.error("synchronizeProductInstockInformationToERP失败:" + paramsResult.toString());
throw new RuntimeException("synchronizeProductInstockInformationToERP失败:" + paramsResult.toString());
}
} catch (Exception e) {
log.error("synchronizeProductInstockInformationToERP失败:" + e.getMessage());
throw new RuntimeException("synchronizeProductInstockInformationToERP失败:" + e.getMessage());
}
}
@ -368,26 +447,44 @@ public class WmsErpScheduledTaskServiceImpl implements IWmsErpScheduledTaskServi
wmsProductOutstock.setUpdateDate(DateUtils.getNowDate());
wmsProductOutstockMapper.updateWmsProductOutstock(wmsProductOutstock);
}
data.put("FDate", DateUtils.getTime());
String fdate = DateUtils.getTime();
if (outstock.getApplyDate() != null) {
fdate = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, outstock.getApplyDate());
}
String specificationParameter = StringUtils.isNotEmpty(outstock.getSpecificationParameter()) ?
outstock.getSpecificationParameter() : outstock.getMaterialSpec();
if (StringUtils.isEmpty(specificationParameter)) {
specificationParameter = "无";
}
data.put("FDate", fdate);
data.put("FMaterialId", outstock.getMaterialCode());
data.put("FAuxPropId", outstock.getSpecificationParameter() == null ? "无" : outstock.getSpecificationParameter());
data.put("FAuxPropId", specificationParameter);
data.put("FUnitID", outstock.getUnitCode());
data.put("FQty", FRealQty);
data.put("FPrice", outstock.getPrice());
data.put("FStockId", wmsConfig.getfStockId());
data.put("FTONDCombo", "一般领料");
String params = data.toJSONString();
R<AjaxResult> paramsResult = remoteJindieService.saveOtherOutStorage(params, SecurityConstants.INNER);
String paramsResultData = paramsResult.getMsg();
JSONObject jsonObject = JSONObject.parseObject(paramsResultData);
Boolean isSuccess = (Boolean) jsonObject.get("IsSuccess");
if (isSuccess) {
result++;
log.info("synchronizeProductOutstockInformationToERP成功:" + paramsResult.toString());
} else {
log.error("synchronizeProductOutstockInformationToERP失败:" + paramsResult.toString());
throw new RuntimeException("synchronizeProductOutstockInformationToERP失败:" + paramsResult.toString());
try {
R<AjaxResult> paramsResult = remoteJindieService.saveOtherOutStorage(params, SecurityConstants.INNER);
String paramsResultData = paramsResult.getMsg();
JSONObject jsonObject = JSONObject.parseObject(paramsResultData);
Boolean isSuccess = (Boolean) jsonObject.get("IsSuccess");
if (isSuccess) {
result++;
log.info("synchronizeProductOutstockInformationToERP成功:" + paramsResult.toString());
} else {
log.error("synchronizeProductOutstockInformationToERP失败:" + paramsResult.toString());
throw new RuntimeException("synchronizeProductOutstockInformationToERP失败:" + paramsResult.toString());
}
} catch (Exception e) {
log.error("synchronizeProductOutstockInformationToERP失败:" + e.getMessage());
throw new RuntimeException("synchronizeProductOutstockInformationToERP失败:" + e.getMessage());
}
}

@ -239,11 +239,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
wpi.plan_code,
wpi.instock_type,
wpi.product_id,
wpi.apply_date,
wpi.instock_amount,
wpi.execute_status,
wpi.erp_status,
if(wpi.erp_amount is null, 0, wpi.erp_amount) erp_amount,
mbmi.material_code,
mbmi.material_spec,
mbui.unit_code,
mso.price,
mso.specification_parameter

@ -322,6 +322,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
wpo.erp_status,
if(wpo.erp_amount is null, 0, wpo.erp_amount) erp_amount,
mbmi.material_code,
mbmi.material_spec,
mbui.unit_code,
mso.price,
mso.specification_parameter

@ -35,6 +35,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="materialCode" column="material_code" />
<result property="materialName" column="material_name" />
<result property="materialSpec" column="material_spec" />
<result property="unitCode" column="unit_code" />
<result property="warehouseCode" column="warehouse_code" />
<result property="specificationParameter" column="specification_parameter" />
@ -214,7 +215,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
wri.material_id,
wri.po_no,
wri.purchase_order_id,
wri.apply_date,
mpo.specification_parameter,
mbmi.material_spec,
mpo.src_bill_no,
mbmi.material_code,
mbui.unit_code,

@ -33,6 +33,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="taskType" column="task_type" />
<result property="materialCode" column="material_code" />
<result property="materialName" column="material_name" />
<result property="materialSpec" column="material_spec" />
<result property="barcodeSpec" column="barcode_spec" />
</resultMap>
<sql id="selectWmsRawOutstockDetailVo">
@ -130,6 +132,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="outstockAmount != null">outstock_amount = #{outstockAmount},</if>
<if test="executeStatus != null">execute_status = #{executeStatus},</if>
<if test="erpStatus != null">erp_status = #{erpStatus},</if>
<if test="erpAmount != null">erp_amount = #{erpAmount},</if>
<if test="outstockPerson != null">outstock_person = #{outstockPerson},</if>
<if test="outstockTime != null">outstock_time = #{outstockTime},</if>
<if test="outstockWay != null">outstock_way = #{outstockWay},</if>
@ -208,4 +211,49 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
</select>
<select id="selectWmsRawOutstockDetailERPNotSynchronized" parameterType="WmsRawOutstockDetail" resultMap="WmsRawOutstockDetailResult">
select wrod.raw_outstock_detail_id,
wrod.raw_outstock_id,
wrod.warehouse_id,
wrod.material_barcode,
wrod.material_id,
wrod.outstock_time,
mbmi.material_code,
mbmi.material_spec,
mbbi.barcode_spec,
mbui.unit_code,
wrod.plan_amount,
wrod.outstock_amount,
if(wrod.erp_amount is null, 0, wrod.erp_amount) erp_amount,
wrod.erp_status,
mpo.price,
mpo.specification_parameter
from wms_raw_outstock_detail wrod
left join wms_raw_outstock wro on wrod.raw_outstock_id = wro.raw_outstock_id
left join mes_base_material_info mbmi on mbmi.material_id = wro.material_id
left join mes_base_unit_info mbui on mbui.erp_id = mbmi.material_unit_id
left join mes_product_plan mpp on mpp.plan_code = wro.plan_code
left join mes_base_barcode_info mbbi on wrod.material_barcode = mbbi.barcode_info
left join mes_purchase_order mpo on mpo.purchase_order_id = mbbi.purchase_order_id
<where>
wrod.outstock_amount > 0
and wrod.plan_amount >= wrod.outstock_amount
and wrod.outstock_amount > if(wrod.erp_amount is null, 0, wrod.erp_amount)
and mbmi.material_classfication = '1'
and mbmi.material_unit_id is not null and mbmi.material_unit_id !=''
and mbbi.purchase_order_id is not null and mbbi.purchase_order_id !=0
<if test="taskTypeStr != null and taskTypeStr != ''"> and wro.task_type in (${taskTypeStr})</if>
<if test="taskType != null and taskType != ''"> and wro.task_type = #{taskType}</if>
</where>
</select>
</mapper>

@ -264,7 +264,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select wro.raw_outstock_id, wro.task_code, wro.warehouse_id, wro.location_code, wro.order_id, wro.plan_code, wro.plan_detail_code, wro.station_id,wro.material_batch,
wro.material_id, wro.operation_type, wro.task_type, wro.apply_reason, wro.audit_reason, wro.audit_status, wro.execute_status, wro.apply_by, wro.apply_date,
wro.audit_by, wro.audit_date, wro.update_by, wro.update_date, wro.begin_time, wro.end_time,wro.outstock_amount,wro.real_outstock_amount,wbw.warehouse_name
,mbmi.material_code,mbmi.material_name,mbmi.material_spec
from wms_raw_outstock wro left join wms_base_warehouse wbw on wro.warehouse_id = wbw.warehouse_id
left join mes_base_material_info mbmi on wro.material_id=mbmi.material_id
<where>
<if test="taskCode != null and taskCode != ''"> and wro.task_code like concat('%', #{taskCode}, '%')</if>
<if test="warehouseId != null "> and wro.warehouse_id = #{warehouseId}</if>
@ -275,6 +277,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="executeStatus != null and executeStatus != ''"> and wro.execute_status = #{executeStatus}</if>
<if test="taskType != null and taskType != ''"> and wro.task_type = #{taskType}</if>
<if test="applyBy != null and applyBy != ''"> and wro.apply_by like concat('%', #{applyBy}, '%')</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 wro.apply_date desc
</select>
@ -366,6 +371,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
wro.warehouse_id,
wro.operation_type,
wro.material_id,
wro.apply_date,
mbmi.material_code,
mbui.unit_code,
wro.outstock_amount,

@ -30,6 +30,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="materialCode" column="material_code" />
<result property="materialName" column="material_name" />
<result property="materialSpec" column="material_spec" />
<result property="barcodeSpec" column="barcode_spec" />
<result property="purchaseOrderId" column="purchase_order_id" />
<result property="unitCode" column="unit_code" />
@ -131,6 +132,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="returnAmount != null">return_amount = #{returnAmount},</if>
<if test="executeStatus != null and executeStatus != ''">execute_status = #{executeStatus},</if>
<if test="erpStatus != null">erp_status = #{erpStatus},</if>
<if test="erpAmount != null">erp_amount = #{erpAmount},</if>
<if test="returnPerson != null">return_person = #{returnPerson},</if>
<if test="returnTime != null">return_time = #{returnTime},</if>
<if test="returnWay != null and returnWay != ''">return_way = #{returnWay},</if>
@ -218,11 +220,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectWmsRawReturnDetailERPNotSynchronized" parameterType="WmsRawReturnDetail" resultMap="WmsRawReturnDetailResult">
select wrrd.raw_return_detail_id,
wrrd.material_id,
wrrd.return_time,
mbbi.purchase_order_id,
mbmi.material_spec,
mbmi.material_code,
mbbi.barcode_spec,
mbui.unit_code,
wrrd.return_amount,
wrrd.return_time,
if(wrrd.erp_amount is null, 0, wrrd.erp_amount) erp_amount,
wrrd.erp_status
from wms_raw_return_detail wrrd

@ -475,7 +475,7 @@ export default {
const poNo = row.poNo;
const params = {queryParams: this.queryParams ,t: Date.now()};
this.$tab.openPage("订单绑定[" + poNo + "]", '/mes/purchase-order/bind/' + purchaseOrderId +'/'+materialSpec, params);
this.$tab.openPage("订单绑定[" + poNo + "]", '/mes/purchase-order/bind/' + purchaseOrderId +'/'+encodeURIComponent(materialSpec), params);
},
/** 提交按钮 */
submitForm() {

@ -385,7 +385,7 @@ export default {
},
handleRouter(row){
let params = {};
if (row.routerAddressDetail != null){
if (row.routerAddressDetail != null && row.routerAddressDetail !==''){
params = JSON.parse(row.routerAddressDetail)
}
this.$tab.openPage(row.moduleCode + this.selectDictLabel(this.dict.type.point_type, row.pointType),

@ -667,4 +667,4 @@ export default {
}
}
};
</script>
</script>

@ -355,30 +355,30 @@
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="混放批次" prop="batchMix">
<el-radio-group v-model="form.batchMix" :disabled="disableFlag">
<el-radio
v-for="dict in dict.type.wms_batch_mix_flag"
:key="dict.value"
:label="dict.value"
>{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="混放产品" prop="productMix">
<el-radio-group v-model="form.productMix" :disabled="disableFlag">
<el-radio
v-for="dict in dict.type.wms_product_mix_flag"
:key="dict.value"
:label="dict.value"
>{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
<!-- <el-row>-->
<!-- <el-col :span="12">-->
<!-- <el-form-item label="混放批次" prop="batchMix">-->
<!-- <el-radio-group v-model="form.batchMix" :disabled="disableFlag">-->
<!-- <el-radio-->
<!-- v-for="dict in dict.type.wms_batch_mix_flag"-->
<!-- :key="dict.value"-->
<!-- :label="dict.value"-->
<!-- >{{dict.label}}</el-radio>-->
<!-- </el-radio-group>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- <el-col :span="12">-->
<!-- <el-form-item label="混放产品" prop="productMix">-->
<!-- <el-radio-group v-model="form.productMix" :disabled="disableFlag">-->
<!-- <el-radio-->
<!-- v-for="dict in dict.type.wms_product_mix_flag"-->
<!-- :key="dict.value"-->
<!-- :label="dict.value"-->
<!-- >{{dict.label}}</el-radio>-->
<!-- </el-radio-group>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- </el-row>-->
<el-row>

@ -111,12 +111,12 @@
</el-table-column>
<el-table-column label="盘点次数" align="center" prop="inventoryTime" />
<el-table-column label="同步ERP状态" align="center" prop="erpStatus">
<template slot-scope="scope">
<dict-tag :options="dict.type.wms_erp_status" :value="scope.row.erpStatus"/>
</template>
</el-table-column>
<el-table-column label="同步ERP数量" align="center" prop="erpAmount" />
<!-- <el-table-column label="同步ERP状态" align="center" prop="erpStatus">-->
<!-- <template slot-scope="scope">-->
<!-- <dict-tag :options="dict.type.wms_erp_status" :value="scope.row.erpStatus"/>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column label="同步ERP数量" align="center" prop="erpAmount" />-->
<el-table-column label="创建时间" align="center" prop="createDate" />
<el-table-column label="最后更新时间" align="center" prop="updateDate" />

@ -491,7 +491,7 @@ export default {
this.form = response.data;
this.wmsProductOutstockDetailList = response.data.wmsProductOutstockDetailList;
this.open = true;
this.title = "修改成品出库记录";
this.title = "成品出库记录明细";
});
},
/** 提交按钮 */

@ -9,16 +9,16 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="仓库" prop="warehouseId">
<el-select v-model="queryParams.warehouseId">
<el-option
v-for="item in warehouseOptions"
:key="item.warehouseId"
:label="item.warehouseName"
:value="item.warehouseId"
/>
</el-select>
</el-form-item>
<!-- <el-form-item label="仓库" prop="warehouseId">-->
<!-- <el-select v-model="queryParams.warehouseId">-->
<!-- <el-option-->
<!-- v-for="item in warehouseOptions"-->
<!-- :key="item.warehouseId"-->
<!-- :label="item.warehouseName"-->
<!-- :value="item.warehouseId"-->
<!-- />-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<el-form-item label="计划编号" prop="planCode">
<el-input
v-model="queryParams.planCode"
@ -35,6 +35,30 @@
@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="taskType">
<el-select
v-model="queryParams.taskType"
@ -101,8 +125,10 @@
<el-table-column label="任务编号" align="center" prop="taskCode" />
<el-table-column label="仓库名称" align="center" prop="warehouseName" />
<el-table-column label="计划编号" align="center" prop="planCode" />
<el-table-column label="计划明细编号" align="center" prop="planDetailCode" />
<el-table-column label="物料批次" align="center" prop="materialBatch" />
<el-table-column label="明细编号" align="center" prop="planDetailCode" />
<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="locationCode" />
<el-table-column label="出库类型" align="center" prop="auditStatus" >
<template slot-scope="scope">

Loading…
Cancel
Save