duhe
2023-12-15 cee8d48e674229258e837838a8fff3285bcdb04b
DAL/²Ö¿â¹ÜÀí/ClsKf_SellOutBillForLayUI.cs
@@ -99,72 +99,178 @@
                //
                oCn.BeginTran();
                string mainSql = "UpDate Kf_ICStockBillMain set  " +
                " HBillNo='" + omodel.HBillNo + "'" +  //固定赋值===============
                ",HDate='" + omodel.HDate + "'" +
                ",HYear='" + omodel.HYear.ToString() + "'" +
                ",HPeriod='" + omodel.HPeriod.ToString() + "'" +
                ",HRemark='" + omodel.HRemark + "'" +
                ",HUpDater='" + DBUtility.ClsPub.CurUserName + "'" +
                ",HUpDateDate=getdate()" +
                //========================================
                ",HOrgID=" + omodel.HOrgID +
                ",HStockORGID=" + omodel.HOrgID +
                //string mainSql = "UpDate Kf_ICStockBillMain set  " +
                //" HBillNo='" + omodel.HBillNo + "'" +  //固定赋值===============
                //",HDate='" + omodel.HDate + "'" +
                //",HYear='" + omodel.HYear.ToString() + "'" +
                //",HPeriod='" + omodel.HPeriod.ToString() + "'" +
                //",HRemark='" + omodel.HRemark + "'" +
                //",HUpDater='" + DBUtility.ClsPub.CurUserName + "'" +
                //",HUpDateDate=getdate()" +
                ////========================================
                //",HOrgID=" + omodel.HOrgID +
                //",HStockORGID=" + omodel.HOrgID +
                ",HEmpID=" + omodel.HEmpID.ToString() +
                ",HSupID=" + omodel.HSupID.ToString() +
                ",HWHID=" + omodel.HWHID.ToString() +
                ",HSellSID=" + omodel.HSellSID.ToString() +
                ",HDeptID=" + omodel.HDeptID.ToString() +
                ",HSecManagerID=" + omodel.HSecManagerID.ToString() +
                ",HKeeperID=" + omodel.HKeeperID.ToString() +
                ",HManagerID=" + omodel.HManagerID.ToString() +
                ",HCheckStatusMan='" + omodel.HCheckStatusMan.ToString() + "'" +
                ",HConveyCompID=" + omodel.HConveyCompID.ToString() +
                ",HConveyTypeID=" + omodel.HConveyTypeID.ToString() +
                ",HCarriage=" + omodel.HCarriage.ToString() +
                ",HExplanation='" + omodel.HExplanation + "'" +
                ",HSeOrderBillNo='" + omodel.HSeOrderBillNo + "'" +
                //",HEmpID=" + omodel.HEmpID.ToString() +
                //",HSupID=" + omodel.HSupID.ToString() +
                //",HWHID=" + omodel.HWHID.ToString() +
                //",HSellSID=" + omodel.HSellSID.ToString() +
                //",HDeptID=" + omodel.HDeptID.ToString() +
                //",HSecManagerID=" + omodel.HSecManagerID.ToString() +
                //",HKeeperID=" + omodel.HKeeperID.ToString() +
                //",HManagerID=" + omodel.HManagerID.ToString() +
                //",HCheckStatusMan='" + omodel.HCheckStatusMan.ToString() + "'" +
                //",HConveyCompID=" + omodel.HConveyCompID.ToString() +
                //",HConveyTypeID=" + omodel.HConveyTypeID.ToString() +
                //",HCarriage=" + omodel.HCarriage.ToString() +
                //",HExplanation='" + omodel.HExplanation + "'" +
                //",HSeOrderBillNo='" + omodel.HSeOrderBillNo + "'" +
                ",HCurID=" + omodel.HCurID.ToString() +
                ",HSCWHID=" + omodel.HSCWHID.ToString() +
                ",HInnerBillNo='" + omodel.HInnerBillNo + "'" +
                ",HLinkPhone='" + omodel.HLinkPhone + "'" +
                ",HLinkMan='" + omodel.HLinkMan + "'" +
                ",HConveyMoney=" + omodel.HConveyMoney.ToString() +
                ",HRedBlueFlag=" + DBUtility.ClsPub.BoolToString(omodel.HRedBlueFlag) +
                " where HInterID=" + lngBillKey.ToString();
                //",HCurID=" + omodel.HCurID.ToString() +
                //",HSCWHID=" + omodel.HSCWHID.ToString() +
                //",HInnerBillNo='" + omodel.HInnerBillNo + "'" +
                //",HLinkPhone='" + omodel.HLinkPhone + "'" +
                //",HLinkMan='" + omodel.HLinkMan + "'" +
                //",HConveyMoney=" + omodel.HConveyMoney.ToString() +
                //",HRedBlueFlag=" + DBUtility.ClsPub.BoolToString(omodel.HRedBlueFlag) +
                //" where HInterID=" + lngBillKey.ToString();
                //更新主表
                oCn.RunProc(mainSql);
                string mainSql = "update Kf_ICStockBillMain set " +
                    "HDate = '" + omodel.HDate + "'" +
                    ",HYear = " + omodel.HDate.Year + "" +
                    ",HPeriod = " + omodel.HDate.Month + "" +
                    ",HRemark = '" + omodel.HRemark + "'" +
                    ",HUpDater = '" + omodel.HUpDater + "'" +
                    ",HUpDateDate = " + "getdate()" + "" +
                    ",HSTOCKORGID = " + omodel.HOrgID + "" +
                    ",HOWNERID = " + omodel.HOrgID + "" +
                    ",HOrgID = " + omodel.HOrgID + "" +
                    ",HMainSourceInterID = " + omodel.HMainSourceInterID + "" +
                    ",HMainSourceEntryID = " + omodel.HMainSourceEntryID + "" +
                    ",HMainSourceBillNo = '" + omodel.HMainSourceBillNo + "'" +
                    ",HMainSourceBillType = '" + omodel.HMainSourceBillType + "'" +
                    ",HDeptID = " + omodel.HDeptID + "" +
                    ",HManagerID = " + omodel.HManagerID + "" +
                    ",HEmpID = " + omodel.HEmpID + "" +
                    ",HSupID = " + omodel.HSupID + "" +
                    ",HSecManagerID = " + omodel.HSecManagerID + "" +
                    ",HKeeperID = " + omodel.HKeeperID + "" +
                    ",HWHID = " + omodel.HWHID + "" +
                    ",HSCWHID = " + omodel.HSCWHID + "" +
                    ",HCurID = " + omodel.HCurID + "" +
                    ",HExRate = " + omodel.HExRate + "" +
                    ",HSellSID = " + omodel.HSellSID + "" +
                    ",HLinkMan = '" + omodel.HLinkMan + "'" +
                    ",HLinkPhone = '" + omodel.HLinkPhone + "'" +
                    ",HSeOrderBillNo = '" + omodel.HSeOrderBillNo + "'" +
                    ",HConVeyCompID = " + omodel.HConveyCompID + "" +
                    ",HConveyTypeID = " + omodel.HConveyTypeID + "" +
                    ",HConveyMoney = " + omodel.HConveyMoney + "" +
                    ",HExplanation = '" + omodel.HExplanation + "'" +
                    ",HInnerBillNo = '" + omodel.HInnerBillNo + "'" +
                    ",HCarriage = " + omodel.HCarriage + "" +
                    ",HCheckStatusMan = '" + omodel.HCheckStatusMan + "'" +
                    " where HInterID = " + lngBillKey;
               //更新主表
               oCn.RunProc(mainSql);
                //删除关联
                DeleteRelation(ref sReturn, lngBillKey);
                //删除子表
                DeleteBillSub(lngBillKey);
                //插入子表
                omodel.HInterID = lngBillKey;
                int HEntryID = 1;
                foreach (Model.ClsKf_SellOutBillSub oSub in DetailColl)
                {
                    oCn.RunProc("Insert into Kf_ICStockBillSub " +
                      " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" +
                      ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
                      ",HMaterID,HPropertyID,HSecUnitID,HSecUnitRate,HUnitID,HQtyMust" +
                      ",HQty,HPrice,HMoney,HWHID,HSCWHID,HSPID" +
                      ",HCostPrice,HCostMoney,HSalePrice" +
                      ",HEngineNum,HUnderPanNum,HLeaveFactCard" +
                      ",HSCSPID,HSPGroupID,HBatchNo,HPOOrderInterID,HPOOrderEntryID,HPOOrderBillNo" +
                      ",HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo,HQty_Full,HQty_Empty,HQty_Back" +
                      ") values("
                      + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" +
                      "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
                      "," + oSub.HMaterID.ToString() + "," + oSub.HPropertyID.ToString() + "," + oSub.HSecUnitID.ToString() + "," + oSub.HSecUnitRate.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HQtyMust.ToString() +
                      "," + oSub.HQty.ToString() + "," + oSub.HPrice.ToString() + "," + oSub.HMoney.ToString() + "," + oSub.HWHID.ToString() + "," + oSub.HSCWHID.ToString() + "," + oSub.HSPID.ToString() +
                      "," + oSub.HCostPrice.ToString() + "," + oSub.HCostMoney.ToString() + "," + oSub.HSalePrice.ToString() +
                      ",'" + oSub.HEngineNum + "','" + oSub.HUnderPanNum + "','" + oSub.HLeaveFactCard + "'" +
                      "," + oSub.HSCSPID.ToString() + "," + oSub.HSPGroupID.ToString() + ",'" + oSub.HBatchNo + "'," + oSub.HPOOrderInterID.ToString() + "," + oSub.HPOOrderEntryID.ToString() + ",'" + oSub.HPOOrderBillNo + "'" +
                      "," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'," + oSub.HQty_Full +
                      "," + oSub.HQty_Empty + "," + oSub.HQty_Back +
                      ") ");
                    string subSql = "Insert into Kf_ICStockBillSub" +
                     " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" +
                     ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
                     ",HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" +
                     ",HMaterID,HUnitID,HQtyMust,HQty,HPrice,HMoney,HTaxPrice,HTaxRate,HTaxMoney,HWHID" +
                     ",HSPID,HSCWHID,HSCSPID,HSPGroupID,HBatchNo,HPOOrderInterID,HPOOrderEntryID,HPOOrderBillNo" +
                     ",HQty_Full,HQty_Empty,HQty_Back,HCostPrice,HCostMoney,HSalePrice" +
                     ",HPropertyID,HSecUnitID,HSecUnitRate" +
                     ",HEngineNum,HUnderPanNum,HLeaveFactCard" +
                     ") values(" +
                     "" + omodel.HInterID.ToString() + "" +
                     "," + (HEntryID++) + "" +
                     ",'" + oSub.HCloseMan + "'" +
                     ",'" + oSub.HEntryCloseDate.ToShortDateString() + "'" +
                     "," + Convert.ToString(oSub.HCloseType ? 1 : 0) + "" +
                     ",'" + oSub.HRemark + "'" +
                     "," + oSub.HSourceInterID.ToString() + "" +
                     "," + oSub.HSourceEntryID.ToString() + "" +
                     ",'" + oSub.HSourceBillNo + "'" +
                     ",'" + oSub.HSourceBillType + "'" +
                     "," + oSub.HRelationQty.ToString() + "" +
                     "," + oSub.HRelationMoney.ToString() + "" +
                     "," + oSub.HSeOrderInterID.ToString() + "" +
                     "," + oSub.HSeOrderEntryID.ToString() + "" +
                     ",'" + oSub.HSeOrderBillNo + "'" +
                     "," + oSub.HMaterID.ToString() + "" +
                     "," + oSub.HUnitID.ToString() + "" +
                     "," + oSub.HQtyMust.ToString() + "" +
                     "," + oSub.HQty.ToString() + "" +
                     "," + oSub.HPrice.ToString() + "" +
                     "," + oSub.HMoney.ToString() + "" +
                     "," + oSub.HTaxPrice.ToString() + "" +
                     "," + oSub.HTaxRate.ToString() + "" +
                     "," + oSub.HTaxMoney.ToString() + "" +
                     "," + oSub.HWHID.ToString() + "" +
                     "," + oSub.HSPID.ToString() + "" +
                     "," + oSub.HSCWHID.ToString() + "" +
                     "," + oSub.HSCSPID.ToString() + "" +
                     "," + oSub.HSPGroupID.ToString() + "" +
                     ",'" + oSub.HBatchNo + "'" +
                     "," + oSub.HPOOrderInterID.ToString() + "" +
                     "," + oSub.HPOOrderEntryID.ToString() + "" +
                     ",'" + oSub.HPOOrderBillNo + "'" +
                     "," + oSub.HQty_Full + "" +
                     "," + oSub.HQty_Empty + "" +
                     "," + oSub.HQty_Back + "" +
                     "," + oSub.HCostPrice.ToString() + "" +
                     "," + oSub.HCostMoney.ToString() + "" +
                     "," + oSub.HSalePrice.ToString() + "" +
                     "," + oSub.HPropertyID.ToString() + "" +
                     "," + oSub.HSecUnitID.ToString() + "" +
                     "," + oSub.HSecUnitRate.ToString() + "" +
                     ",'" + oSub.HEngineNum + "'" +
                     ",'" + oSub.HUnderPanNum + "'" +
                     ",'" + oSub.HLeaveFactCard + "'" +
                     ") ";
                    oCn.RunProc(subSql);
                    //oCn.RunProc("Insert into Kf_ICStockBillSub " +
                    //  " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" +
                    //  ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
                    //  ",HMaterID,HPropertyID,HSecUnitID,HSecUnitRate,HUnitID,HQtyMust" +
                    //  ",HQty,HPrice,HMoney,HWHID,HSCWHID,HSPID" +
                    //  ",HCostPrice,HCostMoney,HSalePrice" +
                    //  ",HEngineNum,HUnderPanNum,HLeaveFactCard" +
                    //  ",HSCSPID,HSPGroupID,HBatchNo,HPOOrderInterID,HPOOrderEntryID,HPOOrderBillNo" +
                    //  ",HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo,HQty_Full,HQty_Empty,HQty_Back" +
                    //  ") values("
                    //  + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" +
                    //  "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
                    //  "," + oSub.HMaterID.ToString() + "," + oSub.HPropertyID.ToString() + "," + oSub.HSecUnitID.ToString() + "," + oSub.HSecUnitRate.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HQtyMust.ToString() +
                    //  "," + oSub.HQty.ToString() + "," + oSub.HPrice.ToString() + "," + oSub.HMoney.ToString() + "," + oSub.HWHID.ToString() + "," + oSub.HSCWHID.ToString() + "," + oSub.HSPID.ToString() +
                    //  "," + oSub.HCostPrice.ToString() + "," + oSub.HCostMoney.ToString() + "," + oSub.HSalePrice.ToString() +
                    //  ",'" + oSub.HEngineNum + "','" + oSub.HUnderPanNum + "','" + oSub.HLeaveFactCard + "'" +
                    //  "," + oSub.HSCSPID.ToString() + "," + oSub.HSPGroupID.ToString() + ",'" + oSub.HBatchNo + "'," + oSub.HPOOrderInterID.ToString() + "," + oSub.HPOOrderEntryID.ToString() + ",'" + oSub.HPOOrderBillNo + "'" +
                    //  "," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'," + oSub.HQty_Full +
                    //  "," + oSub.HQty_Empty + "," + oSub.HQty_Back +
                    //  ") ");
                }
                //更新订单关联数量
                AddNewRelation(ref sReturn, omodel.HInterID);
@@ -202,48 +308,176 @@
                //
                oCn.BeginTran();
                //主表
                oCn.RunProc("Insert Into Kf_ICStockBillMain   " +
                "(HBillType,HBillSubType,HInterID,HBillNo,HDate" +
                ",HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HMainSourceBillType" +
                ",HYear,HPeriod,HRemark,HMaker,HMakeDate,HOrgID,HStockORGID" +
                ",HSupID,HWHID,HSCWHID,HEmpID,HManagerID"+
                ",HSecManagerID,HSellSID,HCurID" +
                ",HLinkMan,HLinkPhone" +
                ",HSeOrderBillNo,HConveyCompID,HConveyTypeID,HConveyMoney" +
                ",HKeeperID,HDeptID,HExplanation,HInnerBillNo,HRedBlueFlag,HCarriage,HCheckStatusMan" +
                ") " +
                " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "'" +
                "," + omodel.HMainSourceInterID + "," + omodel.HMainSourceEntryID + ",'" + omodel.HMainSourceBillNo + "','" + omodel.HMainSourceBillType + "'" +
                ", " + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + omodel.HMaker + "',getdate()" + "," + omodel.HOrgID + "," + omodel.HOrgID +
                ", " + omodel.HSupID.ToString() + "," + omodel.HWHID.ToString() + "," + omodel.HSCWHID.ToString() + "," + omodel.HEmpID.ToString() + "," + omodel.HManagerID.ToString() +
                "," + omodel.HSecManagerID.ToString() + "," + omodel.HSellSID.ToString() + "," + omodel.HCurID.ToString() +
                ",'" + omodel.HLinkMan + "','" + omodel.HLinkPhone + "'" +
                ",'" + omodel.HSeOrderBillNo + "'," + omodel.HConveyCompID.ToString() + "," + omodel.HConveyTypeID.ToString() + "," + omodel.HConveyMoney.ToString() +
                ", " + omodel.HKeeperID.ToString() + "," + omodel.HDeptID.ToString() + ",'" + omodel.HExplanation + "','" + omodel.HInnerBillNo + "'," + DBUtility.ClsPub.BoolToString(omodel.HRedBlueFlag) + "," + omodel.HCarriage + ",'" + omodel.HCheckStatusMan + "'" +
                ") ");
                string mainSql = "Insert Into Kf_ICStockBillMain" +
                    "(HInterID,HBillNo,HDate,HYear,HPeriod,HBillType,HBillSubType,HRemark,HMaker,HMakeDate,HBillStatus,HSTOCKORGID,HOWNERID,HOrgID" +
                    ",HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HMainSourceBillType" +
                    ",HDeptID,HManagerID,HEmpID,HSupID,HSecManagerID,HKeeperID,HWHID,HSCWHID,HCurID,HExRate,HSellSID,HLinkMan,HLinkPhone" +
                    ",HSeOrderBillNo" +
                    ",HConveyCompID,HConveyTypeID,HConveyMoney" +
                    ",HExplanation,HInnerBillNo,HRedBlueFlag,HCarriage,HCheckStatusMan" +
                    ") " +
                    "values(" +
                    "" + omodel.HInterID.ToString() + "" +
                    ",'" + omodel.HBillNo + "'" +
                    ",'" + omodel.HDate + "'" +
                    "," + omodel.HYear.ToString() + "" +
                    "," + omodel.HPeriod.ToString() + "" +
                    ",'" + this.BillType + "'" +
                    ",'" + this.HBillSubType + "'" +
                    ",'" + omodel.HRemark + "'" +
                    ",'" + omodel.HMaker + "'" +
                    "," + "getdate()" + "" +
                    "," + "1" + "" +
                    "," + omodel.HOrgID + "" +
                    "," + omodel.HOrgID + "" +
                    "," + omodel.HOrgID + "" +
                    "," + omodel.HMainSourceInterID + "" +
                    "," + omodel.HMainSourceEntryID + "" +
                    ",'" + omodel.HMainSourceBillNo + "'" +
                    ",'" + omodel.HMainSourceBillType + "'" +
                    "," + omodel.HDeptID.ToString() + "" +
                    "," + omodel.HManagerID.ToString() +
                    "," + omodel.HEmpID.ToString() + "" +
                    ", " + omodel.HSupID.ToString() + "" +
                    "," + omodel.HSecManagerID.ToString() + "" +
                    ", " + omodel.HKeeperID.ToString() + "" +
                    "," + omodel.HWHID.ToString() + "" +
                    "," + omodel.HSCWHID.ToString() + "" +
                    "," + omodel.HCurID.ToString() + "" +
                    "," + omodel.HExRate.ToString() + "" +
                    "," + omodel.HSellSID.ToString() + "" +
                    ",'" + omodel.HLinkMan + "'" +
                    ",'" + omodel.HLinkPhone + "'" +
                    ",'" + omodel.HSeOrderBillNo + "'" +
                    "," + omodel.HConveyCompID.ToString() + "" +
                    "," + omodel.HConveyTypeID.ToString() + "" +
                    "," + omodel.HConveyMoney.ToString() + "" +
                    ",'" + omodel.HExplanation + "'" +
                    ",'" + omodel.HInnerBillNo + "'" +
                    "," + DBUtility.ClsPub.BoolToString(omodel.HRedBlueFlag) + "" +
                    "," + omodel.HCarriage + "" +
                    ",'" + omodel.HCheckStatusMan + "'" +
                    ") ";
                oCn.RunProc(mainSql);
                //oCn.RunProc("Insert Into Kf_ICStockBillMain   " +
                //"(HBillType,HBillSubType,HInterID,HBillNo,HDate" +
                //",HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HMainSourceBillType" +
                //",HYear,HPeriod,HRemark,HMaker,HMakeDate,HOrgID,HStockORGID" +
                //",HSupID,HWHID,HSCWHID,HEmpID,HManagerID" +
                //",HSecManagerID,HSellSID,HCurID" +
                //",HLinkMan,HLinkPhone" +
                //",HSeOrderBillNo,HConveyCompID,HConveyTypeID,HConveyMoney" +
                //",HKeeperID,HDeptID,HExplanation,HInnerBillNo,HRedBlueFlag,HCarriage,HCheckStatusMan" +
                //") " +
                //" values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "'" +
                //"," + omodel.HMainSourceInterID + "," + omodel.HMainSourceEntryID + ",'" + omodel.HMainSourceBillNo + "','" + omodel.HMainSourceBillType + "'" +
                //", " + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + omodel.HMaker + "',getdate()" + "," + omodel.HOrgID + "," + omodel.HOrgID +
                //", " + omodel.HSupID.ToString() + "," + omodel.HWHID.ToString() + "," + omodel.HSCWHID.ToString() + "," + omodel.HEmpID.ToString() + "," + omodel.HManagerID.ToString() +
                //"," + omodel.HSecManagerID.ToString() + "," + omodel.HSellSID.ToString() + "," + omodel.HCurID.ToString() +
                //",'" + omodel.HLinkMan + "','" + omodel.HLinkPhone + "'" +
                //",'" + omodel.HSeOrderBillNo + "'," + omodel.HConveyCompID.ToString() + "," + omodel.HConveyTypeID.ToString() + "," + omodel.HConveyMoney.ToString() +
                //", " + omodel.HKeeperID.ToString() + "," + omodel.HDeptID.ToString() + ",'" + omodel.HExplanation + "','" + omodel.HInnerBillNo + "'," + DBUtility.ClsPub.BoolToString(omodel.HRedBlueFlag) + "," + omodel.HCarriage + ",'" + omodel.HCheckStatusMan + "'" +
                //") ");
                //插入子表
                int HEntryID = 1;
                foreach (Model.ClsKf_SellOutBillSub oSub in DetailColl)
                {
                    oCn.RunProc("Insert into Kf_ICStockBillSub " +
                    string subSql = "Insert into Kf_ICStockBillSub" +
                      " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" +
                      ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
                      ",HMaterID,HPropertyID,HSecUnitID,HSecUnitRate,HUnitID,HQtyMust" +
                      ",HQty,HPrice,HMoney,HWHID,HSCWHID,HSPID" +
                      ",HCostPrice,HCostMoney,HSalePrice" +
                      ",HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" +
                      ",HMaterID,HUnitID,HQtyMust,HQty,HPrice,HMoney,HTaxPrice,HTaxRate,HTaxMoney,HWHID" +
                      ",HSPID,HSCWHID,HSCSPID,HSPGroupID,HBatchNo,HPOOrderInterID,HPOOrderEntryID,HPOOrderBillNo" +
                      ",HQty_Full,HQty_Empty,HQty_Back,HCostPrice,HCostMoney,HSalePrice" +
                      ",HPropertyID,HSecUnitID,HSecUnitRate" +
                      ",HEngineNum,HUnderPanNum,HLeaveFactCard" +
                      ",HSCSPID,HSPGroupID,HBatchNo,HPOOrderInterID,HPOOrderEntryID,HPOOrderBillNo" +
                      ",HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo,HQty_Full,HQty_Empty,HQty_Back" +
                      ") values("
                      + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" +
                      "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
                      "," + oSub.HMaterID.ToString() + "," + oSub.HPropertyID.ToString() + "," + oSub.HSecUnitID.ToString() + "," + oSub.HSecUnitRate.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HQtyMust.ToString() +
                      "," + oSub.HQty.ToString() + "," + oSub.HPrice.ToString() + "," + oSub.HMoney.ToString() + "," + oSub.HWHID.ToString() + "," + oSub.HSCWHID.ToString() + "," + oSub.HSPID.ToString() +
                      "," + oSub.HCostPrice.ToString() + "," + oSub.HCostMoney.ToString() + "," + oSub.HSalePrice.ToString() +
                      ",'" + oSub.HEngineNum + "','" + oSub.HUnderPanNum + "','" + oSub.HLeaveFactCard + "'" +
                      "," + oSub.HSCSPID.ToString() + "," + oSub.HSPGroupID.ToString() + ",'" + oSub.HBatchNo + "'," + oSub.HPOOrderInterID.ToString() + "," + oSub.HPOOrderEntryID.ToString() + ",'" + oSub.HPOOrderBillNo + "'" +
                      "," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'," + oSub.HQty_Full +
                      "," + oSub.HQty_Empty + "," + oSub.HQty_Back +
                      ") ");
                      ") values(" +
                      "" + omodel.HInterID.ToString() + "" +
                      "," + (HEntryID++) + "" +
                      ",'" + oSub.HCloseMan + "'" +
                      ",'" + oSub.HEntryCloseDate.ToShortDateString() + "'" +
                      "," + Convert.ToString(oSub.HCloseType ? 1 : 0) + "" +
                      ",'" + oSub.HRemark + "'" +
                      "," + oSub.HSourceInterID.ToString() + "" +
                      "," + oSub.HSourceEntryID.ToString() + "" +
                      ",'" + oSub.HSourceBillNo + "'" +
                      ",'" + oSub.HSourceBillType + "'" +
                      "," + oSub.HRelationQty.ToString() + "" +
                      "," + oSub.HRelationMoney.ToString() + "" +
                      "," + oSub.HSeOrderInterID.ToString() + "" +
                      "," + oSub.HSeOrderEntryID.ToString() + "" +
                      ",'" + oSub.HSeOrderBillNo + "'" +
                      "," + oSub.HMaterID.ToString() + "" +
                      "," + oSub.HUnitID.ToString() + "" +
                      "," + oSub.HQtyMust.ToString() + "" +
                      "," + oSub.HQty.ToString() + "" +
                      "," + oSub.HPrice.ToString() + "" +
                      "," + oSub.HMoney.ToString() + "" +
                      "," + oSub.HTaxPrice.ToString() + "" +
                      "," + oSub.HTaxRate.ToString() + "" +
                      "," + oSub.HTaxMoney.ToString() + "" +
                      "," + oSub.HWHID.ToString() + "" +
                      "," + oSub.HSPID.ToString() + "" +
                      "," + oSub.HSCWHID.ToString() + "" +
                      "," + oSub.HSCSPID.ToString() + "" +
                      "," + oSub.HSPGroupID.ToString() + "" +
                      ",'" + oSub.HBatchNo + "'" +
                      "," + oSub.HPOOrderInterID.ToString() + "" +
                      "," + oSub.HPOOrderEntryID.ToString() + "" +
                      ",'" + oSub.HPOOrderBillNo + "'" +
                      "," + oSub.HQty_Full + "" +
                      "," + oSub.HQty_Empty + "" +
                      "," + oSub.HQty_Back + "" +
                      "," + oSub.HCostPrice.ToString() + "" +
                      "," + oSub.HCostMoney.ToString() + "" +
                      "," + oSub.HSalePrice.ToString() + "" +
                      "," + oSub.HPropertyID.ToString() + "" +
                      "," + oSub.HSecUnitID.ToString() + "" +
                      "," + oSub.HSecUnitRate.ToString() + "" +
                      ",'" + oSub.HEngineNum + "'" +
                      ",'" + oSub.HUnderPanNum + "'" +
                      ",'" + oSub.HLeaveFactCard + "'" +
                      ") ";
                    oCn.RunProc(subSql);
                    //oCn.RunProc("Insert into Kf_ICStockBillSub " +
                    //  " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" +
                    //  ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
                    //  ",HMaterID,HPropertyID,HSecUnitID,HSecUnitRate,HUnitID,HQtyMust" +
                    //  ",HQty,HPrice,HMoney,HWHID,HSCWHID,HSPID" +
                    //  ",HCostPrice,HCostMoney,HSalePrice" +
                    //  ",HEngineNum,HUnderPanNum,HLeaveFactCard" +
                    //  ",HSCSPID,HSPGroupID,HBatchNo,HPOOrderInterID,HPOOrderEntryID,HPOOrderBillNo" +
                    //  ",HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo,HQty_Full,HQty_Empty,HQty_Back" +
                    //  ") values("
                    //  + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" +
                    //  "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
                    //  "," + oSub.HMaterID.ToString() + "," + oSub.HPropertyID.ToString() + "," + oSub.HSecUnitID.ToString() + "," + oSub.HSecUnitRate.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HQtyMust.ToString() +
                    //  "," + oSub.HQty.ToString() + "," + oSub.HPrice.ToString() + "," + oSub.HMoney.ToString() + "," + oSub.HWHID.ToString() + "," + oSub.HSCWHID.ToString() + "," + oSub.HSPID.ToString() +
                    //  "," + oSub.HCostPrice.ToString() + "," + oSub.HCostMoney.ToString() + "," + oSub.HSalePrice.ToString() +
                    //  ",'" + oSub.HEngineNum + "','" + oSub.HUnderPanNum + "','" + oSub.HLeaveFactCard + "'" +
                    //  "," + oSub.HSCSPID.ToString() + "," + oSub.HSPGroupID.ToString() + ",'" + oSub.HBatchNo + "'," + oSub.HPOOrderInterID.ToString() + "," + oSub.HPOOrderEntryID.ToString() + ",'" + oSub.HPOOrderBillNo + "'" +
                    //  "," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'," + oSub.HQty_Full +
                    //  "," + oSub.HQty_Empty + "," + oSub.HQty_Back +
                    //  ") ");
                }
                //更新订单关联数量
                AddNewRelation(ref sReturn, omodel.HInterID);