yxj
2023-07-25 4a51a8a7b9ea89bcc5d5c0668a88cf0534b494cf
DAL/³µ¼ä¹ÜÀí/ClsSc_ProcessExchangeBill.cs
@@ -9,6 +9,7 @@
    {
        public Model.ClsSc_ProcessExchangeBillMain omodel = new Model.ClsSc_ProcessExchangeBillMain();
        public List<Model.ClsSc_ProcessExchangeBillSub> DetailColl = new List<Model.ClsSc_ProcessExchangeBillSub>();
        Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
        public ClsSc_ProcessExchangeBill()
        {
@@ -58,11 +59,11 @@
            {
                //
                oCn.BeginTran();
                //更新主表
                oCn.RunProc("UpDate Sc_ProcessExchangeBillMain set  " +
                string sql = string.Format(@"UpDate Sc_ProcessExchangeBillMain set  " +
                " HBillNo='" + omodel.HBillNo + "'" +  //固定赋值===============
                ",HDate='" + omodel.HDate + "'" +
                ",HYear='" + omodel.HYear.ToString() + "'" +
                ",HPRDORGID='" + omodel.HPRDORGID.ToString() + "'" +
                ",HPeriod='" + omodel.HPeriod.ToString() + "'" +
                ",HRemark='" + omodel.HRemark + "'" +
                ",HUpDater='" + DBUtility.ClsPub.CurUserName + "'" +
@@ -86,13 +87,37 @@
                ",HExplanation='" + omodel.HExplanation + "'" +
                ",HInnerBillNo='" + omodel.HInnerBillNo + "'" +
                ",HSupID=" + omodel.HSupID.ToString() +
                ",HEmpID=" + omodel.HEmpID.ToString() +
                ",HCusID=" + omodel.HCusID.ToString() +
                ",HMainMaterID=" + omodel.HMainMaterID.ToString() +
                ",HKeyMaterID=" + omodel.HKeyMaterID.ToString() +
                ",HWorkShopID=" + omodel.HWorkShopID.ToString() +
                ",HEquipMentID=" + omodel.HEquipMentID.ToString() +
                ",HProjectNum='" + omodel.HProjectNum.ToString() + "'" +
                ",HMateOutBatchNo='" + omodel.HMateOutBatchNo + "'" +
                ",HBLFlag='" + (omodel.HBLFlag ? 1 : 0) + "'" +
                ",HMachineLine='" + omodel.HMachineLine + "'" +
                ",HXTNumber='" + omodel.HXTNumber  + "'" +
                ",HXTModel='" + omodel.HXTModel + "'" +
                ",HRemark2='" + omodel.HRemark2 + "'" +
                ",HRemark3='" + omodel.HRemark3 + "'" +
                ",HCusNumber='" + omodel.HCusNumber + "'" +
                ",HMaterModel='" + omodel.HMaterModel + "'" +
                ",HWidth='" + omodel.HWidth + "'" +
                ",HWeight='" + omodel.HWeight + "'" +
                ",HAuxQty='" + omodel.HAuxQty + "'" +
                ",HAuxUnit='" + omodel.HAuxUnit + "'" +
                ",HSplitNo='" + omodel.HSplitNo + "'" +
                ",HHeight='" + omodel.HHeight + "'" +
                ",HInches='" + omodel.HInches + "'" +
                ",HAl1Long='" + omodel.HAl1Long + "'" +
                ",HDensity='" + omodel.HDensity + "'" +
                ",HTela='" + omodel.HTela + "'" +
                ",HSplitSumQty='" + omodel.HSplitSumQty + "'" +
                ",HSplitColorQty='" + omodel.HSplitColorQty + "'" +
                ",HUnderTela='" + omodel.HUnderTela + "'" +
                ",HSizing='" + omodel.HSizing + "'" +
                ",HSellDate='" + omodel.HSellDate + "'" +
                ",HProdMaterCode='" + omodel.HProdMaterCode + "'" +
                ",HSeOrderBillNo='" + omodel.HSeOrderBillNo + "'" +
                ",HCusShortName='" + omodel.HCusShortName + "'" +
@@ -117,9 +142,13 @@
                ",HMaterTexture='" + omodel.HMaterTexture + "'" +
                ",HProductNum='" + omodel.HProductNum + "'" +
                ",HVerNum='" + omodel.HVerNum + "'" +
                ",HColorRemark='" + omodel.HColorRemark + "'" +
                ",HWorkBillSortNo='" + omodel.HWorkBillSortNo + "'" +
                //加入生产类型
                ",HWorkTypeNum='" + omodel.HWorkTypeNum + "'" +
                " where HInterID=" + lngBillKey.ToString());
                //更新主表
                oCn.RunProc(sql);
                //删除关联
                DeleteRelation(ref sReturn, lngBillKey);
                //删除子表
@@ -128,7 +157,8 @@
                omodel.HInterID = lngBillKey;
                foreach (Model.ClsSc_ProcessExchangeBillSub oSub in DetailColl)
                {
                    oCn.RunProc("Insert into Sc_ProcessExchangeBillSub " +
                    string sql1 = string.Format(@"Insert into Sc_ProcessExchangeBillSub " +
                      " (HInterID,HEntryID,HBillNo_bak," +
                      "HCloseMan,HEntryCloseDate,HCloseType,HRemark," +
                      "HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType," +
@@ -146,26 +176,27 @@
                      ",HLastProc,HKeyProc,HFstProc,HICMOInterID,HICMOBillNo,HWWOrderInterID," +
                      "HWWOrderEntryID,HWWOrderBillNo,HReportQty,HBackProc" +
                      ",HSupID,HSupFlag,HOverRate,HMaxQty,HTechnologyParameter,HProcCheckNote,HPicNum" +
                      ",HMouldNo,HProcWorkNum" +
                      ",HMouldNo,HProcWorkNum,HSeOrderInterID,HSeOrderEntryID,HRelationQty_OutBad" +
                      ") values("
                      + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + omodel.HBillNo + "'" +
                      ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate + "'," + 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.HRelationQty_In.ToString() + ","
                      "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "',"
                      + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + "," + oSub.HRelationQty_In.ToString() + ","
                      + oSub.HRelationQty_Out.ToString() + "," + oSub.HRelationQty_WWOrder.ToString() + "," + oSub.HRelationQty_Bad.ToString() +
                      "," + oSub.HProcNo.ToString() + "," + oSub.HProcID.ToString() + ",'" + oSub.HProcNumber + "','" + oSub.HWorkRemark + "'" +
                      "," + oSub.HCenterID.ToString() + "," + oSub.HDeptID.ToString() + ",'" + oSub.HDeptNumber + "'," + oSub.HGroupID.ToString() +
                      ",'" + oSub.HGroupNumber + "'," + oSub.HWorkerID.ToString() + ",'" + oSub.HWorkerNumber + "'," + oSub.HSourceID.ToString() +
                      ",'" + oSub.HQty + "','" + oSub.HTimeUnit + "','" + oSub.HPlanWorkTimes + "','" + oSub.HPlanBeginDate.ToShortDateString() + "'" +
                      ",'" + oSub.HPlanEndDate.ToShortDateString() + "','" + oSub.HRelBeginDate.ToShortDateString() + "','" + oSub.HRelEndDate.ToShortDateString() + "'" +
                      ",'" + oSub.HQty + "','" + oSub.HTimeUnit + "','" + oSub.HPlanWorkTimes + "','" + omodel.HPlanBeginDate.ToShortDateString() + "'" +
                      ",'" + omodel.HPlanEndDate.ToShortDateString() + "',getdate(),getdate()" +
                      "," + oSub.HReadyTime.ToString() + "," + oSub.HQueueTime.ToString() + "," + oSub.HMoveTime.ToString() + "," + oSub.HBeginDayQty.ToString() +
                      "," + oSub.HBeginFixQty.ToString() + "," + oSub.HFixWorkDays.ToString() + "," + oSub.HTrunWorkDays.ToString() + "," + oSub.HReadyTimes.ToString() +
                      "," + oSub.HMyWorkDays.ToString() + "," + oSub.HOutPrice.ToString() + "," + oSub.HOutMoney.ToString() + "," + oSub.HPassRate.ToString() + ",'" + oSub.HLastProc + "'" +
                      ",'" + oSub.HKeyProc + "','" + oSub.HFstProc + "'," + oSub.HICMOInterID.ToString() + ",'" + oSub.HICMOBillNo + "'," + oSub.HWWOrderInterID.ToString() +
                      "," + oSub.HWWOrderEntryID.ToString() + ",'" + oSub.HWWOrderBillNo + "'," + oSub.HReportQty.ToString() + "," + Convert.ToString(oSub.HBackProc ? 1 : 0) +
                      "," + oSub.HSupID.ToString() + "," + Convert.ToString(oSub.HSupFlag ? 1 : 0) + "," + oSub.HOverRate.ToString() + "," + oSub.HMaxQty.ToString() + ",'" + oSub.HTechnologyParameter + "','" + oSub.HProcCheckNote + "','" + oSub.HPicNum + "'" +
                      ",'" + oSub.HMouldNo.ToString() + "','" + oSub.HProcWorkNum.ToString() + "'" +
                      ",'" + oSub.HMouldNo + "','" + oSub.HProcWorkNum + "','" + DBUtility.ClsPub.isInt(omodel.HSeOrderInterID) + "','" + DBUtility.ClsPub.isInt(omodel.HSeOrderEntryID) + "','" + DBUtility.ClsPub.isInt(oSub.HRelationQty_OutBad) + "'" +
                      ") ");
                    oCn.RunProc(sql1);
                }
                //
                oCn.RunProc("exec h_p_Sc_ProcessExchangeBill_SetRemark " + omodel.HInterID.ToString()); //设置 å¤‡æ³¨ ä¸º å·¥è‰ºæµ
@@ -264,6 +295,7 @@
        //新增单据
        public override bool AddBill(ref string sReturn)
        {
            string sErr = "";
            try
            {
                //得到mainid
@@ -274,6 +306,7 @@
                //omodel.HProjectNum = "";
                //omodel.HProjectNum = GetNewCodeByNum(omodel.HInterID, 1, 3).ToString();
                //
                oCn.BeginTran();
                //主表
                oCn.RunProc("Insert Into Sc_ProcessExchangeBillMain   " +
@@ -286,9 +319,11 @@
                ",HProdMaterCode,HSeOrderBillNo,HCusShortName,HCusNeedMaterial,HPlanSendGoodsDate" +
                ",HProdMaterName,HCusName,HWorkRemark,HImportNote,HMaterNumber_A" +
                ",HMaterNumber_B,HMaterNumber_C,HMaterNumber_D,HProdType,HMaterShortName" +
                ",HMaterIDA,HMaterIDB,HMaterIDC,HMaterIDD,HICMOEntryID" +
                ",HPicNumVer,HPicNumAssemble,HMaterTexture,HProductNum,HVerNum" +
                ") " +
                ",HMaterIDA,HMaterIDB,HMaterIDC,HMaterIDD,HICMOEntryID" +
",HPicNumVer,HPicNumAssemble,HMaterTexture,HProductNum,HVerNum,HPRDORGID,HBLFlag,HCusNumber,HPickLabel,HPickLabelNumber,HXTNumber,HXTModel,HWorkBillSortNo" +
               ", HRoutingBillID,HMaterModel,HWidth,HWeight,HAuxQty,HAuxUnit,HSplitNo" +
               ",HHeight,HInches,HAl1Long,HDensity,HTela,HUnderTela,HSizing,HSellDate" +
               ",HRemark2,HRemark3,HEmpID,HCusID,HColorRemark,HSplitSumQty,HSplitColorQty,HMachineLine) " +
                " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "','" + omodel.HMaker + "',getdate()," + "" + (omodel.HPrevMainSourceInterID == 0 ? omodel.HInterID : omodel.HPrevMainSourceInterID) +
                "," + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + omodel.HBatchNo + "'," + omodel.HMainMaterID.ToString() + "," + omodel.HKeyMaterID.ToString() + "," + omodel.HNo.ToString() + ",'" + omodel.HOrderProcNO + "'" +
                "," + omodel.HWWOrderInterID.ToString() + "," + omodel.HWWOrderEntryID.ToString() + ",'" + omodel.HWWOrderBillNo + "'," + omodel.HICMOInterID.ToString() + "," + omodel.HEquipMentID.ToString() +
@@ -299,40 +334,55 @@
                ",'" + omodel.HProdMaterName + "','" + omodel.HCusName + "','" + omodel.HWorkRemark + "','" + omodel.HImportNote + "','" + omodel.HMaterNumber_A + "'" +
                ",'" + omodel.HMaterNumber_B + "','" + omodel.HMaterNumber_C + "','" + omodel.HMaterNumber_D + "','" + omodel.HProdType + "','" + omodel.HMaterShortName + "'" +
                ",'" + omodel.HMaterIDA + "','" + omodel.HMaterIDB + "','" + omodel.HMaterIDC + "','" + omodel.HMaterIDD + "'," + omodel.HICMOEntryID +
                ",'" + omodel.HPicNumVer + "','" + omodel.HPicNumAssemble + "','" + omodel.HMaterTexture + "','" + omodel.HProductNum + "','" + omodel.HVerNum + "'" +
                ") ");
                ",'" + omodel.HPicNumVer + "','" + omodel.HPicNumAssemble + "','" + omodel.HMaterTexture + "','" + omodel.HProductNum + "','" + omodel.HVerNum + "','"+ omodel.HPRDORGID+ "','" + (omodel.HBLFlag ? 1 : 0) + "','" + omodel.HCusNumber + "','" + omodel.HPickLabel + "','" + omodel.HPickLabelNumber + "','" + omodel.HXTNumber + "','" + omodel.HXTModel + "','" + omodel.HWorkBillSortNo +
                "',"+ omodel.HRoutingBillID + ",'"+ omodel.HMaterModel + "',"+ omodel.HWidth + ","+ omodel.HWeight + ","+ omodel.HAuxQty + ","+ omodel.HAuxUnit +","+ omodel.HSplitNo +"" +
                ",'" + omodel.HHeight + "','" + omodel.HInches + "','" + omodel.HAl1Long + "','" + omodel.HDensity + "','" + omodel.HTela + "','" + omodel.HUnderTela + "','" + omodel.HSizing + "','" + omodel.HSellDate + "'" +
                ",'"+ omodel.HRemark2 + "','"+ omodel.HRemark3 + "',"+ omodel.HEmpID + "," + omodel.HCusID + ",'"+ omodel.HColorRemark + "',"+ omodel.HSplitSumQty + ","+ omodel.HSplitColorQty + ",'"+ omodel.HMachineLine + "')");
                sErr = sErr + "1;";
                //插入子表
                foreach (Model.ClsSc_ProcessExchangeBillSub oSub in DetailColl)
                {
                    oCn.RunProc("Insert into Sc_ProcessExchangeBillSub " +
                    string sql1 = string.Format(@"Insert into Sc_ProcessExchangeBillSub " +
                      " (HInterID,HEntryID,HBillNo_bak," +
                      "HCloseMan,HEntryCloseDate,HCloseType,HRemark," +
                      "HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney," +
                      "HProcNo,HProcID,HProcNumber,HWorkRemark,HCenterID,HDeptID" +
                      ",HDeptNumber,HGroupID,HGroupNumber,HWorkerID,HWorkerNumber,HSourceID" +
                      ",HQty,HTimeUnit,HPlanWorkTimes,HPlanBeginDate,HPlanEndDate,HRelBeginDate" +
                      "HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType," +
                      "HRelationQty,HRelationMoney,HRelationQty_In," +
                      "HRelationQty_Out,HRelationQty_WWOrder,HRelationQty_Bad," +
                      "HProcNo,HProcID,HProcNumber,HWorkRemark," +
                      "HCenterID,HDeptID" +
                      ",HDeptNumber,HGroupID," +
                      "HGroupNumber,HWorkerID,HWorkerNumber,HSourceID" +
                      ",HQty,HTimeUnit,HPlanWorkTimes,HPlanBeginDate," +
                      "HPlanEndDate,HRelBeginDate" +
                      ",HRelEndDate,HReadyTime,HQueueTime,HMoveTime,HBeginDayQty,HBeginFixQty" +
                      ",HFixWorkDays,HTrunWorkDays,HReadyTimes,HMyWorkDays,HOutPrice,HOutMoney,HPassRate" +
                      ",HLastProc,HKeyProc,HFstProc,HICMOInterID,HICMOBillNo,HWWOrderInterID,HWWOrderEntryID,HWWOrderBillNo,HReportQty,HBackProc" +
                      ",HFixWorkDays,HTrunWorkDays,HReadyTimes," +
                      "HMyWorkDays,HOutPrice,HOutMoney,HPassRate" +
                      ",HLastProc,HKeyProc,HFstProc,HICMOInterID,HICMOBillNo,HWWOrderInterID," +
                      "HWWOrderEntryID,HWWOrderBillNo,HReportQty,HBackProc" +
                      ",HSupID,HSupFlag,HOverRate,HMaxQty,HTechnologyParameter,HProcCheckNote,HPicNum" +
                      ",HMouldNo,HProcWorkNum" +
                      ",HMouldNo,HProcWorkNum,HSeOrderInterID,HSeOrderEntryID" +
                      ") values("
                      + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + omodel.HBillNo + "'" +
                      ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate + "'," + 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.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "',"
                      + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + "," + oSub.HRelationQty_In.ToString() + ","
                      + oSub.HRelationQty_Out.ToString() + "," + oSub.HRelationQty_WWOrder.ToString() + "," + oSub.HRelationQty_Bad.ToString() +
                      "," + oSub.HProcNo.ToString() + "," + oSub.HProcID.ToString() + ",'" + oSub.HProcNumber + "','" + oSub.HWorkRemark + "'" +
                      "," + oSub.HCenterID.ToString() + "," + oSub.HDeptID.ToString() + ",'" + oSub.HDeptNumber + "'," + oSub.HGroupID.ToString() +
                      ",'" + oSub.HGroupNumber + "'," + oSub.HWorkerID.ToString() + ",'" + oSub.HWorkerNumber + "'," + oSub.HSourceID.ToString() +
                      ",'" + oSub.HQty + "','" + oSub.HTimeUnit + "','" + oSub.HPlanWorkTimes + "','" + oSub.HPlanBeginDate.ToShortDateString() + "'" +
                      ",'" + oSub.HPlanEndDate.ToShortDateString() + "','" + oSub.HRelBeginDate.ToShortDateString() + "','" + oSub.HRelEndDate.ToShortDateString() + "'" +
                      ",'" + oSub.HQty + "','" + oSub.HTimeUnit + "','" + oSub.HPlanWorkTimes + "','" + omodel.HPlanBeginDate.ToShortDateString() + "'" +
                      ",'" + omodel.HPlanEndDate.ToShortDateString() + "',getdate(),getdate()" +
                      "," + oSub.HReadyTime.ToString() + "," + oSub.HQueueTime.ToString() + "," + oSub.HMoveTime.ToString() + "," + oSub.HBeginDayQty.ToString() +
                      "," + oSub.HBeginFixQty.ToString() + "," + oSub.HFixWorkDays.ToString() + "," + oSub.HTrunWorkDays.ToString() + "," + oSub.HReadyTimes.ToString() +
                      "," + oSub.HMyWorkDays.ToString() + "," + oSub.HOutPrice.ToString() + "," + oSub.HOutMoney.ToString() + "," + oSub.HPassRate.ToString() + ",'" + oSub.HLastProc + "'" +
                      ",'" + oSub.HKeyProc + "','" + oSub.HFstProc + "'," + oSub.HICMOInterID.ToString() + ",'" + oSub.HICMOBillNo + "'," + oSub.HWWOrderInterID.ToString() +
                      "," + oSub.HWWOrderEntryID.ToString() + ",'" + oSub.HWWOrderBillNo + "'," + oSub.HReportQty.ToString() + "," + Convert.ToString(oSub.HBackProc ? 1 : 0) +
                      "," + oSub.HSupID.ToString() + "," + Convert.ToString(oSub.HSupFlag ? 1 : 0) + "," + oSub.HOverRate.ToString() + "," + oSub.HMaxQty.ToString() + ",'" + oSub.HTechnologyParameter + "','" +  oSub.HProcCheckNote + "','"+  oSub.HPicNum + "'" +
                      ",'" + oSub.HMouldNo.ToString() + "','" + oSub.HProcWorkNum.ToString() + "'" +
                      "," + oSub.HSupID.ToString() + "," + Convert.ToString(oSub.HSupFlag ? 1 : 0) + "," + oSub.HOverRate.ToString() + "," + oSub.HMaxQty.ToString() + ",'" + oSub.HTechnologyParameter + "','" + oSub.HProcCheckNote + "','" + oSub.HPicNum + "'" +
                      ",'" + oSub.HMouldNo + "','" + oSub.HProcWorkNum + "','" + DBUtility.ClsPub.isStrNull( omodel.HSeOrderInterID) + "','" + DBUtility.ClsPub.isStrNull(omodel.HSeOrderEntryID) + "'" +
                      ") ");
                    sErr = sErr + sql1 + "2;";
                    oCn.RunProc(sql1);
                    sErr = sErr + "2;";
                    //更新所选流转卡数量
                    if (!oSub.HBackProc)
                    {
@@ -343,10 +393,13 @@
                        }
                    }
                    sErr = sErr + "3;";
                }
                oCn.RunProc("exec h_p_Sc_ProcessExchangeBill_SetRemark " + omodel.HInterID.ToString()); //设置 å¤‡æ³¨ ä¸º å·¥è‰ºæµ
                oCn.RunProc("exec h_p_Sc_ProcessExchangeBill_SetUpdate " + omodel.HInterID.ToString()); //设置 æœ«é“ é¦–道 è½¬ ç­‰ä¿¡æ¯
                sErr = sErr + "4;";
                oCn.RunProc("exec h_p_Sc_ProcessExchangeBill_SetUpdate " + omodel.HInterID.ToString()); //设置 æœ«é“ é¦–道 è½¬ ç­‰ä¿¡æ¯   å™¨å…·æ¸…单  å·¥è‰ºå‚数清单;
                sErr = sErr + "5;";
                DataSet ds = new DataSet();
                //设置条码号  å›žå¡« é¢†æ–™æ‰¹æ¬¡
                ds = oCn.RunProcReturn("exec h_p_Mes_ProcessExchangeBackBarCode " + omodel.HInterID.ToString(), "h_p_Mes_ProcessExchangeBackBarCode");
@@ -357,10 +410,11 @@
                    return false;
                }
                sErr = sErr + "6;";
                //oCn.RunProc("exec h_p_Sc_ProcessExchangeBill_SetDate " + omodel.HInterID.ToString());  //回填 å¼€å·¥å®Œå·¥æ—¥æœŸ 
                //oCn.RunProc("exec h_p_Sc_ProcessExchangeBill_RelationQty " + omodel.HInterID.ToString() + ",1"); //返工流转卡 åå†™ æ‹†åˆ†æ•°é‡  å›žå¡«ä»»åŠ¡å• æµè½¬å¡æ•°é‡  å›žå¡«ä»»åŠ¡å•ä¸Šé™æ•°é‡
                //控制关联数量
                ds = null;
                ds = oCn.RunProcReturn("exec h_p_Sc_ProcessExchangeBill_Checkqty " + omodel.HInterID.ToString(), "h_p_Sc_ProcessExchangeBill_Checkqty");
@@ -371,6 +425,38 @@
                    return false;
                }
                sErr = sErr + "7;";
                //工序流转卡保存时自动同步条码信息至条码档案(Y è‡ªåŠ¨åŒæ­¥)
                //获取系统参数
                string sErrMsg = "";
                if (oSystemParameter.ShowBillByOrgID(omodel.HPRDORGID, ref sErrMsg) == true)
                {
                    if (oSystemParameter.omodel.Sc_ProcessExchangeBill_AutoBarCode == "Y") //系统参数  å·¥åºæµè½¬å¡ä¿å­˜æ—¶è‡ªåŠ¨åŒæ­¥æ¡ç ä¿¡æ¯è‡³æ¡ç æ¡£æ¡ˆ
                    {
                        oCn.RunProc("insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty" +
                            ",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty" +
                            ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty" +
                            ",HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark" +
                            ",HCusID,HCusType,HEndDate,HWorkLineName,HBarCodeDate" +
                            ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HGiveAwayFlag" +
                            ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo" +
                            ") values ("
                            + "'" + omodel.HBillNo + "','唯一条码'," + omodel.HMaterID.ToString() + "," + omodel.HUnitID.ToString() + "," + omodel.HQty.ToString()
                            + ",'" + omodel.HBatchNo + "'," + omodel.HSupID.ToString() + ",0,'" + omodel.HMaker + "',getdate(),0," + omodel.HQty.ToString()
                            + ", " + omodel.HInterID.ToString() + ",1,'" + omodel.HBillNo + "','3772',''"
                            + ",1,1,0,0,0,'工序流转卡保存自动同步'"
                            + ",0,'',getdate(),'',getdate()"
                            + ", " + omodel.HPRDORGID + "," + omodel.HPRDORGID + ",'',0,0"
                            + ",'','','',0,'','')");
                    }
                }
                else
                {
                    sReturn = "获取系统参数失败! " + sErrMsg;
                    oCn.RollBack();
                    return false;
                }
                //
                sReturn = "新增单据成功!";
@@ -379,7 +465,7 @@
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                sReturn = sErr + "," +  e.Message;
                oCn.RollBack();
                throw (e);
            }
@@ -391,7 +477,7 @@
            {
                //查询主表
                DataSet Ds;
                Ds = oCn.RunProcReturn("Select * from Sc_ProcessExchangeBillMain Where HInterID=" + lngBillKey.ToString(), "Sc_ProcessExchangeBillMain");
                Ds = oCn.RunProcReturn("Select * from Sc_ProcessExchangeBillMain Where HInterID=" + lngBillKey.ToString()+" and HPRDORGID=" + DBUtility.ClsPub.HOrgID + " ", "Sc_ProcessExchangeBillMain");
                if (Ds.Tables[0].Rows.Count == 0)
                {
                    sReturn = "单据未找到!";
@@ -459,6 +545,27 @@
                omodel.HMaterTexture = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMaterTexture"]);
                omodel.HProductNum = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HProductNum"]);
                omodel.HVerNum = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HVerNum"]);
                omodel.HRoutingBillID = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRoutingBillID"]);
                omodel.HPRDORGID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPRDORGID"]);
                omodel.HMaterModel = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMaterModel"]);
                omodel.HWidth = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HWidth"]);
                omodel.HWeight = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HWeight"]);
                omodel.HAuxQty = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HAuxQty"]);
                omodel.HAuxUnit = DBUtility.ClsPub.isInt(Ds.Tables[0].Rows[0]["HAuxUnit"]);
                omodel.HSplitNo = DBUtility.ClsPub.isInt(Ds.Tables[0].Rows[0]["HSplitNo"]);
                omodel.HRemark2 = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRemark2"]);
                omodel.HRemark3 = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRemark3"]);
                omodel.HEmpID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HEmpID"].ToString());
                omodel.HHeight = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HHeight"]);
                omodel.HInches = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HInches"]);
                omodel.HAl1Long = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HAl1Long"]);
                omodel.HDensity = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HDensity"]);
                omodel.HTela = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HTela"]);
                omodel.HUnderTela = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HUnderTela"]);
                omodel.HSizing = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HSizing"]);
                omodel.HSellDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HSellDate"]);
                omodel.HCusID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCusID"].ToString());
                omodel.HColorRemark = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HColorRemark"].ToString());
                //
                //循环
                DataSet DsSub;