From c7a8432cfe46db0aaa1075a5411775919e3ce647 Mon Sep 17 00:00:00 2001 From: 16358 <1635849544@qq.com> Date: Mon, 16 Jun 2025 17:58:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=98=9F=E7=A9=BA=E5=AF=B9=E6=8E=A5=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ruoyi/bill/domain/Poundmst.java | 94 +++++++++++++++---- .../ruoyi/bill/service/IPoundmstService.java | 8 ++ .../service/impl/PoundmstServiceImpl.java | 14 +++ .../main/java/com/ruoyi/webApi/ApiTask.java | 83 +++++++++++++++- .../measurement/bill/PoundappliMapper.xml | 5 +- .../measurement/bill/PoundmstMapper.xml | 54 ++++++++--- .../main/resources/mybatis/mybatis-config.xml | 20 ++-- .../views/measurement/bill/poundmst/index.vue | 32 +++++-- 8 files changed, 260 insertions(+), 50 deletions(-) diff --git a/measurement/src/main/java/com/ruoyi/bill/domain/Poundmst.java b/measurement/src/main/java/com/ruoyi/bill/domain/Poundmst.java index 812e379..ac11396 100644 --- a/measurement/src/main/java/com/ruoyi/bill/domain/Poundmst.java +++ b/measurement/src/main/java/com/ruoyi/bill/domain/Poundmst.java @@ -132,6 +132,14 @@ public class Poundmst extends BaseEntity @Excel(name = "重量和") private BigDecimal carmqtysum; + /** 计划重量 */ + @Excel(name = "计划重量") + private BigDecimal qty; + + /** 回传重量 */ + @Excel(name = "回传重量") + private BigDecimal resQty; + /** 序号 */ @Excel(name = "序号") private String indexid; @@ -180,16 +188,28 @@ public class Poundmst extends BaseEntity /** 回传星空ID */ @Excel(name = "回传星空ID") - private Long fid; + private String fid; /** 回传星空分录ID */ @Excel(name = "回传星空分录ID") - private Long fentityFentryid; + private String fentity_fentryid; /** 星空单据类型 */ @Excel(name = "星空单据类型") private String oabilltype; + //仓库名称 + @Excel(name = "仓库名称") + private String cangKuName; + + //仓库编号 + @Excel(name = "仓库编号") + private String cangKuNumber; + + //生产车间编号 + @Excel(name = "生产车间编号") + private String sccjNum; + public void setId(String id) { this.id = id; @@ -200,7 +220,31 @@ public class Poundmst extends BaseEntity return id; } - public void setUsrcode(String usrcode) + public String getCangKuName() { + return cangKuName; + } + + public void setCangKuName(String cangKuName) { + this.cangKuName = cangKuName; + } + + public String getCangKuNumber() { + return cangKuNumber; + } + + public void setCangKuNumber(String cangKuNumber) { + this.cangKuNumber = cangKuNumber; + } + + public String getSccjNum() { + return sccjNum; + } + + public void setSccjNum(String sccjNum) { + this.sccjNum = sccjNum; + } + + public void setUsrcode(String usrcode) { this.usrcode = usrcode; } @@ -210,7 +254,23 @@ public class Poundmst extends BaseEntity return usrcode; } - public void setSrcbllknd(String srcbllknd) + public BigDecimal getQty() { + return qty; + } + + public void setQty(BigDecimal qty) { + this.qty = qty; + } + + public BigDecimal getResQty() { + return resQty; + } + + public void setResQty(BigDecimal resQty) { + this.resQty = resQty; + } + + public void setSrcbllknd(String srcbllknd) { this.srcbllknd = srcbllknd; } @@ -566,27 +626,23 @@ public class Poundmst extends BaseEntity return lstedtopr; } - public void setFid(Long fid) - { - this.fid = fid; - } - - public Long getFid() - { + public String getFid() { return fid; } - public void setFentityFentryid(Long fentityFentryid) - { - this.fentityFentryid = fentityFentryid; + public void setFid(String fid) { + this.fid = fid; } - public Long getFentityFentryid() - { - return fentityFentryid; + public String getFentity_fentryid() { + return fentity_fentryid; } - public void setOabilltype(String oabilltype) + public void setFentity_fentryid(String fentity_fentryid) { + this.fentity_fentryid = fentity_fentryid; + } + + public void setOabilltype(String oabilltype) { this.oabilltype = oabilltype; } @@ -639,7 +695,7 @@ public class Poundmst extends BaseEntity .append("lstedtopr", getLstedtopr()) .append("remark", getRemark()) .append("fid", getFid()) - .append("fentityFentryid", getFentityFentryid()) + .append("fentity_fentryid", getFentity_fentryid()) .append("oabilltype", getOabilltype()) .toString(); } diff --git a/measurement/src/main/java/com/ruoyi/bill/service/IPoundmstService.java b/measurement/src/main/java/com/ruoyi/bill/service/IPoundmstService.java index ae3cf0f..e4db8cc 100644 --- a/measurement/src/main/java/com/ruoyi/bill/service/IPoundmstService.java +++ b/measurement/src/main/java/com/ruoyi/bill/service/IPoundmstService.java @@ -37,6 +37,14 @@ public interface IPoundmstService extends IService */ public int insertPoundmst(Poundmst poundmst); + /** + * 新增主榜单信息(mybatis) + * + * @param poundmst 主榜单信息 + * @return 结果 + */ + public int insertPoundmstDpi(Poundmst poundmst); + /** * 修改主榜单信息 * diff --git a/measurement/src/main/java/com/ruoyi/bill/service/impl/PoundmstServiceImpl.java b/measurement/src/main/java/com/ruoyi/bill/service/impl/PoundmstServiceImpl.java index 39c833d..101d426 100644 --- a/measurement/src/main/java/com/ruoyi/bill/service/impl/PoundmstServiceImpl.java +++ b/measurement/src/main/java/com/ruoyi/bill/service/impl/PoundmstServiceImpl.java @@ -61,6 +61,20 @@ public class PoundmstServiceImpl extends ServiceImpl i return -1; } + /** + * 新增主榜单信息(mybatis) + * + * @param poundmst 主榜单信息 + * @return 结果 + */ + @Override + public int insertPoundmstDpi(Poundmst poundmst) + { + poundmst.initAddFields(poundmst); + int i = poundmstMapper.insertPoundmst(poundmst); + return i; + } + /** * 修改主榜单信息 * diff --git a/measurement/src/main/java/com/ruoyi/webApi/ApiTask.java b/measurement/src/main/java/com/ruoyi/webApi/ApiTask.java index 45c30f7..5a8677c 100644 --- a/measurement/src/main/java/com/ruoyi/webApi/ApiTask.java +++ b/measurement/src/main/java/com/ruoyi/webApi/ApiTask.java @@ -3,7 +3,9 @@ package com.ruoyi.webApi; import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONObject; import com.ruoyi.bill.domain.Poundappli; +import com.ruoyi.bill.domain.Poundmst; import com.ruoyi.bill.service.IPoundappliService; +import com.ruoyi.bill.service.IPoundmstService; import com.ruoyi.common.core.domain.entity.SysDictData; import com.ruoyi.system.service.ISysConfigService; import com.ruoyi.system.service.ISysDictTypeService; @@ -35,6 +37,8 @@ public class ApiTask { private ISysDictTypeService dictTypeService; @Autowired private IPoundappliService poundappliService; + @Autowired + private IPoundmstService poundmstService; //登录星空接口 public String OAlogin(){ @@ -283,7 +287,11 @@ public class ApiTask { poundappli.setFentity_fentryid(fentryid); poundappli.setSrcbillusrcode(sourceBillNo); poundappli.setOabilltype(formid);//星空单据类型 - poundappli.setSrcbilltype("发货通知单");//来源单据类型 + if("SAL_DELIVERYNOTICE".equals(formid)){ + poundappli.setSrcbilltype("发货通知单");//来源单据类型 + }else { + poundappli.setSrcbilltype("收料通知单");//来源单据类型 + } poundappliService.insertPoundappliDpi(poundappli); } @@ -294,7 +302,80 @@ public class ApiTask { * @param oaData 星空数据 */ public void makeMainPoundFormData(String formid,String oaData){ + // 1. 将 oaData 解析为 JSONArray(二维数组) + JSONArray dataList = JSONArray.parseArray(oaData); + //SP_InStock:生产入库单 STK_TRANSFERAPPLY:调拨申请单 + if ("SP_InStock".equals(formid)){ + // 2. 遍历每一行数据 + for (int i = 0; i < dataList.size(); i++) { + JSONArray row = dataList.getJSONArray(i); + String billno = row.getString(0); // 单号 + String dateStr = row.getString(1); // 磅单日期 + DateTimeFormatter formatter = DateTimeFormatter.ISO_LOCAL_DATE_TIME; + LocalDateTime localDateTime = LocalDateTime.parse(dateStr, formatter); + Date date = Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant()); + String materialNumber = row.getString(24); // 物料编码 + String materialName = row.getString(25); // 物料编码 + String fid = row.getString(26); // 单据头内码 + String fentryid = row.getString(27); // 单据体内码 + String cangkuName = row.getString(28); // 仓库名称 + String cangkuNumber = row.getString(29); // 仓库编码 + String sccjNumber = row.getString(30); // 生产车间编码 + String bbno = row.getString(31); // 班组编码 + + // 3. 保存 + Poundmst poundmst = new Poundmst(); + poundmst.setId(UUID.randomUUID().toString()); + poundmst.setBsndt(date); + poundmst.setSrcbllid(billno); + poundmst.setItmname(materialName); + poundmst.setItmno(materialNumber); + poundmst.setFid(fid); + poundmst.setFentity_fentryid(fentryid); + poundmst.setCangKuName(cangkuName); + poundmst.setCangKuNumber(cangkuNumber); + poundmst.setSccjNum(sccjNumber); + poundmst.setBbno(bbno); + poundmst.setOabilltype(formid);//星空单据类型 + poundmst.setSrcbllknd("简单生产入库单");//来源单据类型 + + poundmstService.insertPoundmstDpi(poundmst); + } + }else { + // 2. 遍历每一行数据 + for (int i = 0; i < dataList.size(); i++) { + JSONArray row = dataList.getJSONArray(i); + String billno = row.getString(1); // 单号 + String dateStr = row.getString(2); // 磅单日期 + DateTimeFormatter formatter = DateTimeFormatter.ISO_LOCAL_DATE_TIME; + LocalDateTime localDateTime = LocalDateTime.parse(dateStr, formatter); + Date date = Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant()); + String materialName = row.getString(3); // 品名 + String specification = row.getString(4); // 规格 + String msrunit = row.getString(7); // 单位 + BigDecimal qty = row.getBigDecimal(8); // 申请数量 + String fid = row.getString(13); // 单据头内码 + String fentryid = row.getString(14); // 单据体内码 + + // 3. 保存 + // 3. 保存过磅申请 + Poundmst poundmst = new Poundmst(); + poundmst.setId(UUID.randomUUID().toString()); + poundmst.setBsndt(date); + poundmst.setSrcbllid(billno); + poundmst.setFid(fid); + poundmst.setItmname(materialName); + poundmst.setSpecification(specification); + poundmst.setMsrunit(msrunit); + poundmst.setQty(qty); + poundmst.setFentity_fentryid(fentryid); + poundmst.setOabilltype(formid);//星空单据类型 + poundmst.setSrcbllknd("调拨申请单");//来源单据类型 + + poundmstService.insertPoundmstDpi(poundmst); + } + } } } \ No newline at end of file diff --git a/measurement/src/main/resources/mapper/measurement/bill/PoundappliMapper.xml b/measurement/src/main/resources/mapper/measurement/bill/PoundappliMapper.xml index 09bf08d..8ba3972 100644 --- a/measurement/src/main/resources/mapper/measurement/bill/PoundappliMapper.xml +++ b/measurement/src/main/resources/mapper/measurement/bill/PoundappliMapper.xml @@ -126,7 +126,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" oabilltype, remark, - SELECT #{id}, @@ -163,12 +162,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{oabilltype}, #{remark}, - FROM DUAL WHERE NOT EXISTS ( SELECT 1 FROM t_data_poundappli - WHERE fentity_fentryid = #{fentity_fentryid} - ) + WHERE (fentity_fentryid = #{fentity_fentryid} OR (fentity_fentryid IS NULL AND #{fentity_fentryid} IS NULL)) ) diff --git a/measurement/src/main/resources/mapper/measurement/bill/PoundmstMapper.xml b/measurement/src/main/resources/mapper/measurement/bill/PoundmstMapper.xml index 36089be..0a27f15 100644 --- a/measurement/src/main/resources/mapper/measurement/bill/PoundmstMapper.xml +++ b/measurement/src/main/resources/mapper/measurement/bill/PoundmstMapper.xml @@ -32,6 +32,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + @@ -45,17 +47,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + + + + - select id, usrcode, srcbllknd, srcbllid, bsndt, bsnid, bllstt, itmno, itmcode, itmname, specification, msrunit, trnunitid, trnunitname, bsunitid, bsunitname, sendunitid, sendunitname, recunitid, recunitname, poundid, poundname, boilerno, steeno, unitlen, carnosum, carmqtysum, indexid, steeltype, linetype, lzno, bbno, crtorgid, isinuse, crtdt, crtopr, lstedtdt, lstedtopr, remark, fid, fentity_fentryid, oabilltype from t_data_poundmst + select id, usrcode, srcbllknd, srcbllid, bsndt, bsnid, bllstt, itmno, itmcode, itmname, specification, msrunit, trnunitid, trnunitname, bsunitid, bsunitname, sendunitid, sendunitname, recunitid, recunitname, poundid, poundname, boilerno, steeno, unitlen, carnosum, carmqtysum, qty, resQty, indexid, steeltype, linetype, lzno, bbno, crtorgid, isinuse, crtdt, crtopr, lstedtdt, lstedtopr, remark, fid, fentity_fentryid, oabilltype, cangKuName, cangKuNumber, sccjNum from t_data_poundmst - +