chen пре 2 година
родитељ
комит
04b01b822a

+ 23 - 4
jeecg-boot-module-system/src/main/java/org/jeecg/modules/openApi/mapper/xml/PurchaseWarehousingMapper.xml

@@ -180,7 +180,16 @@
         iOriCost,
         iOriMoney,
         iTax,
-        ioriSum
+        ioriSum,
+        iUnitCost,
+        iPrice,
+        iAPrice,
+        iOriTaxPrice,
+        iTaxRate,
+        iTaxPrice,
+        iSum,
+        bTaxCost,
+        iProcessFee
         )
         VALUES
         (
@@ -235,7 +244,16 @@
         #{map.iOriCost},
         #{map.iOriMoney},
         #{map.iTax},
-        #{map.ioriSum}
+        #{map.ioriSum},
+        #{map.iUnitCost},
+        #{map.iPrice},
+        #{map.iAPrice},
+        #{map.iOriTaxPrice},
+        #{map.iTaxRate},
+        #{map.iTaxPrice},
+        #{map.iSum},
+        #{map.bTaxCost},
+        #{map.iProcessFee }
         )
     </insert>
 
@@ -308,7 +326,7 @@
     </insert>
 
     <select id="getWhCodeByVenCode" parameterType="java.lang.String" resultType="java.util.HashMap">
-        select cVenCode,cVenDefine1,cVenDefine2,cVenAbbName from Vendor where cVenCode=#{cVenCode}
+        select cVenCode,cVenDefine1,cVenDefine2,cVenAbbName,cVenDefine3 from Vendor where cVenDefine3=#{cVenCode}
     </select>
 
     <select id="getRdrecords01WriteQuantity" resultType="java.math.BigDecimal" parameterType="java.lang.String">
@@ -832,13 +850,14 @@
     </select>
 
     <insert id="insertCurrentStock">
-        INSERT into CurrentStock(cWhCode,cInvCode,ItemId,cBatch,iQuantity,cFree1,cFree2,cFree3,cFree4,cFree5,cFree6,cFree7,cFree8,cFree9,cFree10)
+        INSERT into CurrentStock(cWhCode,cInvCode,ItemId,cBatch,iQuantity,fAvaQuantity,cFree1,cFree2,cFree3,cFree4,cFree5,cFree6,cFree7,cFree8,cFree9,cFree10)
         VALUES(
                #{map.cWhCode},
                #{map.cInvCode},
                #{map.ItemId},
                #{map.cBatch},
                #{map.iQuantity},
+               #{map.iQuantity},
                #{map.cFree1},
                #{map.cFree2},
                #{map.cFree3},

+ 37 - 6
jeecg-boot-module-system/src/main/java/org/jeecg/modules/openApi/service/impl/PurchaseWarehousingServiceImpl.java

@@ -101,8 +101,16 @@ public class PurchaseWarehousingServiceImpl extends ServiceImpl<PurchaseWarehous
                 }else{
                     throw new RuntimeException("获取入库单号失败");
                 }
-                map.put("cMaker","陈创");
-                map.put("cHandler","陈创");
+                if(accID.equals("903")){
+                    if(map.get("cMaker")==null||map.get("cMaker").equals("")){
+                        throw new RuntimeException("缺少制单人字段");
+                    }
+                    map.put("cHandler",map.get("cMaker"));
+                }else{
+                    map.put("cMaker","陈创");
+                    map.put("cHandler","陈创");
+                }
+
                 //日期
                 Long longtime=Long.valueOf(String.valueOf(map.get("dDate")));
                 String formatTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date(longtime));
@@ -160,6 +168,7 @@ public class PurchaseWarehousingServiceImpl extends ServiceImpl<PurchaseWarehous
                     if(whCodeMap!=null){
                         //获取供应商简称
                         map.put("cVenAbbName",whCodeMap.get("cVenAbbName"));
+                        map.put("cVenCode",whCodeMap.get("cVenCode"));
                         //获取成品仓
                         if(whCodeMap.get("cVenDefine2")!=null){
                             String cWhCode=String.valueOf(whCodeMap.get("cVenDefine2"));//成品仓库
@@ -300,6 +309,9 @@ public class PurchaseWarehousingServiceImpl extends ServiceImpl<PurchaseWarehous
                                     getCost(itemMap,mapOMMODetails);
                                     //获取订单的自定义数据
                                     getcFree(itemMap,mapOMMODetails);
+                                    //加工费 原币无税单价*数量
+                                    BigDecimal iProcessFee=getDecimalNew(String.valueOf(itemMap.get("iOriCost"))).multiply(getDecimalNew(String.valueOf(itemMap.get("iQuantity"))));
+                                    itemMap.put("iProcessFee",iProcessFee.doubleValue());
                                     itemMap.put("cWhCode",map.get("cWhCode"));//获取仓库
                                     //回写入库数量到委外订单行
                                     //如果是红字入库则相减
@@ -362,7 +374,7 @@ public class PurchaseWarehousingServiceImpl extends ServiceImpl<PurchaseWarehous
 
                 if(iscVenCodeReceiver){
                     //保存调拨单
-                    saveTransVouch(map,itemList);
+                    saveTransVouch(map,itemList,accID);
                 }
 
             }
@@ -482,6 +494,14 @@ public class PurchaseWarehousingServiceImpl extends ServiceImpl<PurchaseWarehous
         itemMap.put("iOriMoney",mapPOPodetails.get("iMoney"));//原币无税金额
         itemMap.put("iTax",mapPOPodetails.get("iTax"));//税额
         itemMap.put("ioriSum",mapPOPodetails.get("iSum"));//原币价税合计
+        itemMap.put("iUnitCost",mapPOPodetails.get("iUnitPrice"));
+        itemMap.put("iPrice",mapPOPodetails.get("iMoney"));
+        itemMap.put("iAPrice",mapPOPodetails.get("iNatMoney"));
+        itemMap.put("iOriTaxPrice",mapPOPodetails.get("iTax"));
+        itemMap.put("iTaxRate",mapPOPodetails.get("iPerTaxRate"));
+        itemMap.put("iTaxPrice",mapPOPodetails.get("iNatTax"));
+        itemMap.put("iSum",mapPOPodetails.get("iNatSum"));
+        itemMap.put("bTaxCost",mapPOPodetails.get("bTaxCost"));
     }
 
     //获取批次属性赋值
@@ -572,10 +592,15 @@ public class PurchaseWarehousingServiceImpl extends ServiceImpl<PurchaseWarehous
     }
 
     //保存调拨单
-    public void saveTransVouch(Map<String,Object> rdRecord01Map,List<Map<String,Object>> rdRecords01List){
+    public void saveTransVouch(Map<String,Object> rdRecord01Map,List<Map<String,Object>> rdRecords01List,String accID){
         Map<String,Object> transVouchMao=new HashMap<>();
         //获取主表最大ID
-        transVouchMao.put("ID",oConvertUtils.addOne(getMaxId("ID","TransVouch")));
+        Map<String,Integer> pkMap = callGetUAMaxPK2("tr",accID);
+        if(pkMap.get("iFatherId")==null){
+            throw new RuntimeException("获取入库单主表ID失败");
+        }
+        transVouchMao.put("ID",pkMap.get("iFatherId"));
+//        transVouchMao.put("ID",oConvertUtils.addOne(getMaxId("ID","TransVouch")));
         //获取最大编码
         transVouchMao.put("cTVCode",oConvertUtils.addOne(this.baseMapper.getMaxCode("cTVCode","TransVouch","dnmaketime")));
         //修改最大编码
@@ -661,7 +686,13 @@ public class PurchaseWarehousingServiceImpl extends ServiceImpl<PurchaseWarehous
 //                vouchsMap.put("cDefine30",recordsMap.get("cDefine30"));//染厂色号
                 vouchsMap.put("cbMemo",recordsMap.get("cbMemo"));//备注
                 vouchsMap.put("cTVCode",transVouchMao.get("cTVCode"));//主表调拨单号
-                vouchsMap.put("autoID", oConvertUtils.addOne(getMaxId("autoID","TransVouchs")));//子表id
+                //获取子表最大id
+                Map<String,Integer> pkMapChild = callGetUAMaxPK2("tr",accID);
+                if(pkMap.get("iChildId")==null){
+                    throw new RuntimeException("获取调拨单子表ID失败");
+                }
+                vouchsMap.put("autoID",pkMapChild.get("iChildId"));
+//                vouchsMap.put("autoID", oConvertUtils.addOne(getMaxId("autoID","TransVouchs")));//子表id
                 vouchsMap.put("ID",transVouchMao.get("ID"));//主表ID
                 //根据存货与自由项找对应子件