zrg
2024-04-28 56877a7dbdf1983b7e5c74d9fd15798a0f782f89
WebAPI/Controllers/CGGL/Cg_POInStockBillController.cs
@@ -199,30 +199,38 @@
                oCN.BeginTran(); //开始事务
                //查询数据
                ds = oCN.RunProcReturn("select * from Cg_POInStockBillMain a inner join Cg_POInStockBillSub b on a.HInterID=b.HInterID  where a.HInterID= '" + HInterID + "'", "Kf_ICStockBillMain");
               //执行存储过程进行反写
                dss = oCN.RunProcReturn("exec h_p_Cg_POOrderBillMain_Delete " + HQty + ", '" + HSourceInterID + "', '" + HSourceEntryID + "','" + user + " '", "h_p_Cg_POInStockBillMain");
                var sReturn = "";
                if (DBUtility.ClsPub.isLong(dss.Tables[0].Rows[0]["HBack"]) != 0)
                {
                    sReturn = DBUtility.ClsPub.isStrNull(dss.Tables[0].Rows[0]["HBackRemark"]).ToString();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = sReturn;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (ds.Tables[0].Rows.Count == 1)
                {
                    oCN.RunProc("delete Cg_POInStockBillMain where HInterID=" + HInterID);
                    oCN.RunProc("delete Cg_POInStockBillSub where HInterID=" + HInterID);
                }
                else
                {
                    oCN.RunProc($"delete Cg_POInStockBillSub where HInterID={ HInterID}and HEntryID={HsupId}");
                }
                ds = oCN.RunProcReturn("select * from Cg_POInStockBillMain a inner join Cg_POInStockBillSub b on a.HInterID=b.HInterID  where a.HInterID= '" + HInterID + "'", "Cg_POInStockBillMain");
                //收料通知单删除回填采购订单关联数量
                oCN.RunProc("exec h_p_Cg_UpDatePOOrderRelation_Del " + HInterID);
                ////执行存储过程进行反写 该行也是  收料通知单 反写  采购订单
                // dss = oCN.RunProcReturn("exec h_p_Cg_POOrderBillMain_Delete " + HQty + ", '" + HSourceInterID + "', '" + HSourceEntryID + "','" + user + " '", "h_p_Cg_POInStockBillMain");
                var sReturn = "";
                oCN.RunProc("delete Cg_POInStockBillMain where HInterID=" + HInterID);
                oCN.RunProc("delete Cg_POInStockBillSub where HInterID=" + HInterID);
                //if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HBacker"]) != 0)
                //{
                //    sReturn = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]).ToString();
                //    objJsonResult.code = "0";
                //    objJsonResult.count = 0;
                //    objJsonResult.Message = sReturn;
                //    objJsonResult.data = null;
                //    return objJsonResult;
                //}
                //if (ds.Tables[0].Rows.Count == 1)
                //{
                //    oCN.RunProc("delete Cg_POInStockBillMain where HInterID=" + HInterID);
                //    oCN.RunProc("delete Cg_POInStockBillSub where HInterID=" + HInterID);
                //}
                //else
                //{
                //    oCN.RunProc($"delete Cg_POInStockBillSub where HInterID={ HInterID}and HEntryID={HsupId}");
                //}
                oCN.Commit();
@@ -679,19 +687,19 @@
                    NewHEntryID = ClsPub.isLong(Cs.Tables[0].Rows[0]["HEntryID"].ToString());
                    NewHEntryID += 1;
                }
                //反写采购入库单
                //反写采购订单单   上面方法中也有反写  此行 跟 返回结果 给注销
                string sReturn = "";
                ds = oCN.RunProcReturn("exec h_p_Cg_POOrderBillMain " + oSub.HQty + ", '" + oSub.HSourceInterID + "', '" + oSub.HSourceEntryID + "','" + user + " '", "h_p_Cg_POOrderBillMain");
                if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) != 0)
                {
                    sReturn = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]).ToString();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = sReturn;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //ds = oCN.RunProcReturn("exec h_p_Cg_POOrderBillMain " + oSub.HQty + ", '" + oSub.HSourceInterID + "', '" + oSub.HSourceEntryID + "','" + user + " '", "h_p_Cg_POOrderBillMain");
                //if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) != 0)
                //{
                //    sReturn = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]).ToString();
                //    objJsonResult.code = "0";
                //    objJsonResult.count = 0;
                //    objJsonResult.Message = sReturn;
                //    objJsonResult.data = null;
                //    return objJsonResult;
                //}
                oCN.RunProc($@"Insert into Cg_POInStockBillSub 
                (HInterID,HEntryID,HMaterID,HUnitID,HQty,HPrice
               ,HMoney,HTaxRate,HTaxMoney,HWHID,HSPID,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HPOOrderInterID
@@ -703,7 +711,7 @@
               ,HEXCHANGERATE,HLOCALCURRID,HISINCLUDEDTAX,HISPRICEEXCLUDETAX
               ,HTAXRATEID,HCOSTPERCENT,HCOSTAMOUNT,HVAT,HSELLERWITHHOLDING,HBUYERWITHHOLDING,HSecUnitID) 
                 values({HInterID},{NewHEntryID},{oSub.HMaterID},{oSub.HUnitID},{(oSub.HQty == null ? 0 : oSub.HQty)}
                ,{oSub.HPrice},{oSub.HMoney},{oSub.HTaxRate},{oSub.HTaxMoney},{oSub.HWHID},{oSub.HSPID},'{HRemark}',{oSub.HSourceInterID},{oSub.HSourceEntryID},'{HSourceBillNo}',{HSourceBillType},{oSub.HPOOrderInterID},{oSub.HPOOrderEntryID},'{HPOOrderBillNo}',{HAuxPropID},{HBatchNO},{HMTONo},{HPlanMode},{HERPInterID},{HERPEntryID},{HRelationQty},{HGiveAwayFlag},{HReceiveQty},{HSEQ},{HPRODUCEDATE},{HEXPIRYDATE},
                ,{oSub.HPrice},{oSub.HMoney},{oSub.HTaxRate},{oSub.HTaxMoney},{oSub.HWHID},{oSub.HSPID},'{oSub.HRemark}',{oSub.HSourceInterID},{oSub.HSourceEntryID},'{HSourceBillNo}',{HSourceBillType},{oSub.HPOOrderInterID},{oSub.HPOOrderEntryID},'{HPOOrderBillNo}',{HAuxPropID},{HBatchNO},{HMTONo},{HPlanMode},{HERPInterID},{HERPEntryID},{HRelationQty},{HGiveAwayFlag},{HReceiveQty},{HSEQ},{HPRODUCEDATE},{HEXPIRYDATE},
                  {HSUPPLYLOT},{HREQTRACENO},{HBOMID},{HSTOCKUNITID},{HBASEUNITID},{HSTOCKSTATUSID},'{HKEEPERTYPEID}',{HPROJECTNO},{HCHECKINCOMING},{oSub.HTaxPrice},{HDISCOUNTRATE},{HPRICECOEFFICIENT},{HPRICEUNITID},{HPRICELISTENTRY},{HSAMPLEDAMAGEQTY},{HSAMPLEDAMAGEBASEQTY},{HPAYORGID},{HSETTLEORGID},{HSETTLECURRID},{HSETTLEMODEID},{HEXCHANGETYPEID},{HPAYCONDITONID},{oSub.HEXCHANGERATE},{HLOCALCURRID},{HISINCLUDEDTAX},{HISPRICEEXCLUDETAX},{HTAXRATEID},{HCOSTPERCENT},{HCOSTAMOUNT},{HVAT},{HSELLERWITHHOLDING},{HBUYERWITHHOLDING},{oSub.HSecUnitID})");
                
            }