1
chenhaozhe
2025-10-16 b95a245e207539c1e2ddafa683dc9374b399d0fc
WebAPI/Controllers/CGGL/Kf_POStockInBillController.cs
@@ -2143,48 +2143,56 @@
                    }
                }
                // 主表
                oCN.RunProc($@"Insert Into Kf_ICStockBillMain
                    (HInterID,HYear,HPeriod,HBillType,HBillSubType,HDate
                   ,HBillNo,HBillStatus,HSupID,HManagerID,HEmpID,HDeptID,HSecManagerID,HKeeperID,HRemark,HMaker,HMakeDate,HCurID,HExRate,HWHID,HInnerBillNo,HExplanation
                    ,HChecker, HCheckDate, HSTOCKORGID)
                    values(
                    '{mainList[0].HInterID}',
                    '{mainList[0].HYear}',
                    '{mainList[0].HPeriod}',
                    '{mainList[0].HBillType}',
                    '{mainList[0].HBillSubType}',
                    '{mainList[0].HDate}',
                    '{mainList[0].HBillNo}',
                    {mainList[0].HBillStatus},
                    '{mainList[0].HSupID}',
                    '{mainList[0].HManagerID}',
                    '{mainList[0].HEmpID}',
                    '{mainList[0].HDeptID}',
                    '{mainList[0].HSecManagerID}',
                    '{mainList[0].HKeeperID}',
                    '{mainList[0].HRemark}',
                    '{mainList[0].HMaker}',
                    '{mainList[0].HMakeDate}',
                    '{mainList[0].HCurID}',
                    '{mainList[0].HWHID}',
                    '{mainList[0].HInnerBillNo}',
                    '{mainList[0].HExplanation}',
                    '{mainList[0].HChecker}',
                    '{mainList[0].HCheckDate}',
                    {mainList[0].HSTOCKORGID}
                    )
                ");
                // 子表
                // 主表插入
                oCN.RunProc($@"Insert Into Kf_ICStockBillMain
                (HInterID,HYear,HPeriod,HBillType,HBillSubType,HDate,HBillNo,HBillStatus
                ,HAddress,HSupID,HCurID,HWHID,HEmpID,HManagerID,HSecManagerID,HKeeperID,HDeptID,HExplanation,HRemark
                ,HInnerBillNo,HSTOCKORGID,HOWNERID,HMaker,HMakeDate,HProjectID,HInvoiceBillNo
                ,HChecker, HCheckDate)
                values(
                '{mainList[0].HInterID}',
                '{mainList[0].HYear}',
                '{mainList[0].HPeriod}',
                '{mainList[0].HBillType}',
                '{mainList[0].HBillSubType}',
                '{mainList[0].HDate}',
                '{mainList[0].HBillNo}',
                {mainList[0].HBillStatus},
                '{mainList[0].HAddress}',
                '{mainList[0].HSupID}',
                '{mainList[0].HCurID}',
                '{mainList[0].HWHID}',
                '{mainList[0].HEmpID}',
                '{mainList[0].HManagerID}',
                '{mainList[0].HSecManagerID}',
                '{mainList[0].HKeeperID}',
                '{mainList[0].HDeptID}',
                '{mainList[0].HExplanation}',
                '{mainList[0].HRemark}',
                '{mainList[0].HInnerBillNo}',
                {mainList[0].HSTOCKORGID},
                '{mainList[0].HOWNERID}',
                '{mainList[0].HMaker}',
                '{mainList[0].HMakeDate}',
                '{mainList[0].HProjectID}',
                '{mainList[0].HInvoiceBillNo}',
                '{mainList[0].HChecker}',
                '{mainList[0].HCheckDate}'
                )
            ");
                // 子表插入
                foreach (var osub in subList)
                {
                    oCN.RunProc($@"Insert into Kf_ICStockBillSub
                    LogService.Write($@"Insert into Kf_ICStockBillSub
                    (HInterID,HEntryID,HMaterID,HUnitID,HQtyMust,HQty,HPrice
                   ,HMoney,HWHID,HSPID,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HPOOrderInterID
                    ,HPOOrderEntryID,HPOORderBillNo,HSecUnitID,HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo,HRelationQty,HSecUnitRate,HPropertyID)
                    ,HMoney,HOrderPrice,HWHID,HSPID,HRelationQty,HBatchNo
                    ,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType
                    ,HPOOrderInterID,HPOOrderEntryID ,HPOOrderBillNo
                    ,HPropertyID,HSecUnitID,HSecUnitRate,HPlanMode,HRemark,HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo
                    ,HTaxRate,HTaxPrice,HlineTotal)
                    values (
                        '{osub.HInterID}', 
                        '{osub.HEntryID}', 
@@ -2194,9 +2202,11 @@
                        '{osub.HQty}',
                        '{osub.HPrice}',
                        '{osub.HMoney}',
                        '{osub.HOrderPrice}',
                        '{osub.HWHID}',
                        '{osub.HSPID}',
                        '{osub.HRemark}',
                        '{osub.HRelationQty}',
                        '{osub.HBatchNo}',
                        '{osub.HSourceInterID}',
                        '{osub.HSourceEntryID}',
                        '{osub.HSourceBillNo}',
@@ -2204,16 +2214,109 @@
                        '{osub.HPOOrderInterID}',
                        '{osub.HPOOrderEntryID}',
                        '{osub.HPOOrderBillNo}',
                        '{osub.HPropertyID}',
                        '{osub.HSecUnitID}',
                        '{osub.HSecUnitRate}',
                        '{osub.HPlanMode}',
                        '{osub.HRemark}',
                        '{osub.HSeOrderInterID}',
                        '{osub.HSeOrderEntryID}',
                        '{osub.HSeOrderBillNo}',
                        '{osub.HTaxRate}',
                        '{osub.HTaxPrice}',
                        '{osub.HlineTotal}'
                    )
                    ");
                    LogService.Write($@"Insert into Kf_ICStockBillSub
                    (HInterID,HEntryID,HMaterID,HUnitID,HQtyMust,HQty,HPrice
                    ,HMoney,HOrderPrice,HWHID,HSPID,HRelationQty,HBatchNo
                    ,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType
                    ,HPOOrderInterID,HPOOrderEntryID ,HPOOrderBillNo
                    ,HPropertyID,HSecUnitID,HSecUnitRate,HPlanMode,HRemark,HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo
                    ,HTaxRate,HTaxPrice,HlineTotal)
                    values (
                        '{osub.HInterID}',
                        '{osub.HEntryID}',
                        '{osub.HMaterID}',
                        '{osub.HUnitID}',
                        '{osub.HQtyMust}',
                        '{osub.HQty}',
                        '{osub.HPrice}',
                        '{osub.HMoney}',
                        '{osub.HOrderPrice}',
                        '{osub.HWHID}',
                        '{osub.HSPID}',
                        '{osub.HRelationQty}',
                        '{osub.HBatchNo}',
                        '{osub.HSourceInterID}',
                        '{osub.HSourceEntryID}',
                        '{osub.HSourceBillNo}',
                        '{osub.HSourceBillType}',
                        '{osub.HPOOrderInterID}',
                        '{osub.HPOOrderEntryID}',
                        '{osub.HPOOrderBillNo}',
                        '{osub.HPropertyID}',
                        '{osub.HSecUnitID}',
                        '{osub.HSecUnitRate}',
                        '{osub.HPropertyID}'
                        '{osub.HPlanMode}',
                        '{osub.HRemark}',
                        '{osub.HSeOrderInterID}',
                        '{osub.HSeOrderEntryID}',
                        '{osub.HSeOrderBillNo}',
                        '{osub.HTaxRate}',
                        '{osub.HTaxPrice}',
                        '{osub.HlineTotal}'
                    )
                    ");
                    oCN.RunProc($@"Insert into Kf_ICStockBillSub
                    (HInterID,HEntryID,HMaterID,HUnitID,HQtyMust,HQty,HPrice
                    ,HMoney,HOrderPrice,HWHID,HSPID,HRelationQty,HBatchNo
                    ,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType
                    ,HPOOrderInterID,HPOOrderEntryID ,HPOOrderBillNo
                    ,HPropertyID,HSecUnitID,HSecUnitRate,HPlanMode,HRemark,HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo
                    ,HTaxRate,HTaxPrice,HlineTotal)
                    values (
                        '{osub.HInterID}',
                        '{osub.HEntryID}',
                        '{osub.HMaterID}',
                        '{osub.HUnitID}',
                        '{osub.HQtyMust}',
                        '{osub.HQty}',
                        '{osub.HPrice}',
                        '{osub.HMoney}',
                        '{osub.HOrderPrice}',
                        '{osub.HWHID}',
                        '{osub.HSPID}',
                        '{osub.HRelationQty}',
                        '{osub.HBatchNo}',
                        '{osub.HSourceInterID}',
                        '{osub.HSourceEntryID}',
                        '{osub.HSourceBillNo}',
                        '{osub.HSourceBillType}',
                        '{osub.HPOOrderInterID}',
                        '{osub.HPOOrderEntryID}',
                        '{osub.HPOOrderBillNo}',
                        '{osub.HPropertyID}',
                        '{osub.HSecUnitID}',
                        '{osub.HSecUnitRate}',
                        '{osub.HPlanMode}',
                        '{osub.HRemark}',
                        '{osub.HSeOrderInterID}',
                        '{osub.HSeOrderEntryID}',
                        '{osub.HSeOrderBillNo}',
                        '{osub.HTaxRate}',
                        '{osub.HTaxPrice}',
                        '{osub.HlineTotal}'
                    )
                    ");
                }
                //采购入库单新增回填采购入库关联数量
                oCN.RunProc("exec h_p_Cg_UpDateRelation_POOrderToPOStockIn_Add " + mainList[0].HInterID);
                //采购入库单新增回填收料通知单关联数量
                oCN.RunProc("exec h_p_Cg_UpDateRelation_POInStockToPOStockIn_Add " + mainList[0].HInterID);
                oCN.Commit();
@@ -2225,7 +2328,7 @@
            }
            catch (Exception e)
            {
                LogService.Write("生产入库单同步异常,保存方法执行完成异常:" + e.Message.ToString());
                LogService.Write("采购入库单同步异常,保存方法执行完成异常:" + e.Message.ToString());
                oCN.RollBack();
                objJsonResult.code = "0";