DAL/Öʼì¹ÜÀí/ClsQC_OutCompCheckBill.cs
@@ -9,11 +9,13 @@
    {
        public Model.ClsQC_OutCompCheckBillMain omodel = new Model.ClsQC_OutCompCheckBillMain();
        public List<Model.ClsQC_OutCompCheckBillSub> DetailColl = new List<Model.ClsQC_OutCompCheckBillSub>();
        public List<Model.ClsQC_OutCompCheckBillSub_ValueGrid> DetailColl_Value = new List<Model.ClsQC_OutCompCheckBillSub_ValueGrid>();
        //public List<Model.ClsQC_OutCompCheckBillSub_Item> DetailColl1 = new List<Model.ClsQC_OutCompCheckBillSub_Item>();
        public ClsQC_OutCompCheckBill()
        {
            base.MvarItemKeySub = "QC_OutCompCheckBillSub";
            base.MvarItemKeySub2 = "";
            base.MvarItemKeySub2 = "QC_OutCompCheckBillSub_ValueGrid";
            base.MvarItemKeySub3 = "";
            base.MvarItemKeySub4 = "";
            base.MvarItemKey="QC_OutCompCheckBillMain";
@@ -60,18 +62,26 @@
                //",HCloseType="+omodel.HCloseType.ToString()+
                //",HDeleteMan='" + omodel.HDeleteMan + "'" +
                //",HDeleteDate='" + omodel.HDeleteDate + "'" +
                ",HPrintQty="+omodel.HPrintQty.ToString()+
                ",HPrintQty=" + omodel.HPrintQty.ToString() +
                //========================================
                //",HSupID=" + omodel.HSupID.ToString() +
                //",HEmpID=" + omodel.HEmpID.ToString() +
                ",HCusID="+omodel.HCusID.ToString()+
                ",HSourceID=" + omodel.HSourceID.ToString() +
                ",HQCSchemeID=" + omodel.HQCSchemeID.ToString() +
                ",HICMOInterID=" + omodel.HICMOInterID.ToString() +
                ",HICMOBillNo='" + omodel.HICMOBillNo + "'" +
                ",HICMOQty=" + omodel.HICMOQty.ToString() +
                ",HProcExchInterID=" + omodel.HProcExchInterID.ToString() +
                ",HProcExchEntryID=" + omodel.HProcExchEntryID.ToString() +
                ",HProcExchBillNo='" + omodel.HProcExchBillNo + "'" +
                ",HProcExchQty=" + omodel.HProcExchQty.ToString() +
                ",HProcID=" + omodel.HProcID.ToString() +
                ",HMaterID=" + omodel.HMaterID.ToString() +
                ",HInStockQty=" + omodel.HInStockQty.ToString() +
                ",HCheckQty=" + omodel.HCheckQty.ToString() +
                ",HRightQty=" + omodel.HRightQty.ToString() +
                ",HBadQty=" + omodel.HBadQty.ToString() +
                ",HFirstCheckEmp=" + omodel.HFirstCheckEmp.ToString() +
                ",HCheckerResult='" + omodel.HCheckerResult + "'" +
                ",HLastResult=" + DBUtility.ClsPub.BoolToString(omodel.HLastResult) +
                ",HShiftsID=" + omodel.HShiftsID.ToString() +
                ",HErrTreatment='" + omodel.HErrTreatment + "'" +
                ",HBatchNo='" + omodel.HBatchNo + "'" +
                " where HInterID=" + lngBillKey.ToString());
                //删除关联
                DeleteRelation(ref sReturn, lngBillKey);
@@ -85,12 +95,15 @@
                      " (HInterID,HBillNo_bak,HEntryID,HCloseMan" +
                      ",HEntryCloseDate,HCloseType,HRemark,HSourceInterID" +
                      ",HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
                      ",HQCCheckClassID,HQCCheckItemID,HQCStd,HResult" +
                      ",HQCCheckItemID,HQCStd,HUnit,HQCNote,HResult" +
                      ",HMax,HMin,HAvg,HInspectVal,HUpLimit,HDownLimit,HInspectInstruMentID" +
                      ") values("
                      + omodel.HInterID.ToString() + ",'" + oSub.HBillNo_bak + "'," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "'" +
                      ",getdate()," + 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.HQCCheckClassID.ToString() + "," + oSub.HQCCheckItemID.ToString() + ",'" + oSub.HQCStd + "','" + oSub.HResult + "'" + ") ");
                      "," + oSub.HQCCheckItemID.ToString() + ",'" + oSub.HQCStd + "','" + oSub.HUnit + "','" + oSub.HQCNote + "','" + oSub.HResult + "'" +
                      ",'" + oSub.HMax + "','" + oSub.HMin + "','" + oSub.HAvg + "','" + oSub.HInspectVal + "','" + oSub.HUpLimit + "','" + oSub.HDownLimit + "','" + oSub.HInspectInstruMentID + "'" +
                      ") ");
                }
                //foreach (Model.ClsQC_OutCompCheckBillSub_Item oSub2 in DetailColl1)
                //{
@@ -130,26 +143,62 @@
                throw (e);
            }
        }
        //新增检验值
        public virtual bool AddValue(ref string sReturn, ref long HInterID, ref long HEntryID)
        {
            try
            {
                oCn.BeginTran();
                oCn.RunProc("delete from QC_OutCompCheckBillSub_ValueGrid where HInterID = " + HInterID + " and HEntryID = " + HEntryID);
                //插入子表
                foreach (Model.ClsQC_OutCompCheckBillSub_ValueGrid value in DetailColl_Value)
                {
                    oCn.RunProc("Insert into QC_OutCompCheckBillSub_ValueGrid " +
                      " (HInterID,HEntryID,HSEQ,HInSpectResult" +
                      ",HInSpectValue,HInSpectValueB,HInSpectValueT" +
                      ") values("
                      + HInterID + "," + HEntryID + "," + value.HSEQ + ",'" + value.HInSpectResult + "'," +
                      value.HInSpectValue + "," + value.HInSpectValueB + ",'" + value.HInSpectValueT + "'" +
                      ") ");
                }
                sReturn = "新增检验值成功!";
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                oCn.RollBack();
                throw (e);
            }
        }
        //新增单据
        public override bool AddBill(ref string sReturn)
        {
            try
            {
                //得到mainid
                omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
                // omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
                //若MAINDI重复则重新获取
                oCn.BeginTran();
                //主表
                oCn.RunProc("Insert Into QC_OutCompCheckBillMain " +
                "(HBillType,HBillSubType,HInterID,HBillNo,HBillStatus,HDate,HMaker,HMakeDate" +
                ",HYear,HPeriod,HRemark" +
                ",HCusID,HMaterID,HInStockQty,HCheckQty,HRightQty" +
                ",HBadQty,HFirstCheckEmp,HCheckerResult" +
                ",HSourceID,HICMOInterID,HICMOBillNo,HICMOQty,HProcExchInterID,HProcExchEntryID" +
                ",HProcExchBillNo,HProcExchQty,HMaterID,HFirstCheckEmp,HLastResult" +
                ",HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HMainSourceBillType,HICMOEntryID,HQCSchemeID,HShiftsID,HErrTreatment,HBatchNo" +
                ",HTakeSampleCheckBillID,HTakeSampleCheckBillNo,HProcID" +
                ") " +
                " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "'," + omodel.HBillStatus.ToString() + ",'" + omodel.HDate + "','" + DBUtility.ClsPub.CurUserName + "',getdate()" +
                " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "'," + omodel.HBillStatus.ToString() + ",'" + omodel.HDate + "','" + omodel.HMaker + "',getdate()" +
                "," + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "'" +
                "," + omodel.HCusID.ToString() + "," + omodel.HMaterID.ToString() + "," + omodel.HInStockQty.ToString() + "," + omodel.HCheckQty.ToString() + "," + omodel.HRightQty.ToString() +
                "," + omodel.HBadQty.ToString() + "," + omodel.HFirstCheckEmp.ToString() + ",'" + omodel.HCheckerResult + "'"+
                "," + omodel.HSourceID.ToString() + "," + omodel.HICMOInterID.ToString() + ",'" + omodel.HICMOBillNo + "'," + omodel.HICMOQty.ToString() + "," + omodel.HProcExchInterID.ToString() + "," + omodel.HProcExchEntryID.ToString() +
                ",'" + omodel.HProcExchBillNo + "'," + omodel.HProcExchQty.ToString() + "," + omodel.HMaterID.ToString() + "," + omodel.HFirstCheckEmp.ToString() + ", " + DBUtility.ClsPub.BoolToString(omodel.HLastResult) +
                "," + omodel.HMainSourceInterID + "," + omodel.HMainSourceEntryID + ",'" + omodel.HMainSourceBillNo + "','" + omodel.HMainSourceBillType + "'," + omodel.HICMOEntryID + "," + omodel.HQCSchemeID + "," + omodel.HShiftsID + ",'" + omodel.HErrTreatment + "','" + omodel.HBatchNo + "'" +
                "," + omodel.HTakeSampleCheckBillID + ",'" + omodel.HTakeSampleCheckBillNo + "','" + omodel.HProcID + "'" +
                ") ");
                //插入子表
                foreach (Model.ClsQC_OutCompCheckBillSub oSub in DetailColl)
@@ -158,12 +207,19 @@
                      " (HInterID,HBillNo_bak,HEntryID,HCloseMan" +
                      ",HEntryCloseDate,HCloseType,HRemark,HSourceInterID" +
                      ",HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
                      ",HQCCheckClassID,HQCCheckItemID,HQCStd,HResult" +
                      ",HQCCheckItemID,HQCStd,HUnit,HQCNote,HResult" +
                      ",HMax,HMin,HAvg,HSampleSchemeID,HSampleQty,HSampleDamageQty,HAcceptQty" +
                      ",HRejectQty,HSampleUnRightQty,HStatus,HUnitID,HInspectVal,HTargetVal" +
                      ",HUpLimit,HDownLimit,HUpOffSet,HDownOffSet,HKeyInspect,HAnalysisMethod,HInspectInstruMentID,HInspectResult" +
                      ") values("
                      + omodel.HInterID.ToString() + ",'" + oSub.HBillNo_bak + "'," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "'" +
                      ",getdate()," + 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.HQCCheckClassID.ToString() + "," + oSub.HQCCheckItemID.ToString() + ",'" + oSub.HQCStd + "','" + oSub.HResult + "'" + ") ");
                      "," + oSub.HQCCheckItemID.ToString() + ",'" + oSub.HQCStd + "','" + oSub.HUnit + "','" + oSub.HQCNote + "','" + oSub.HResult + "'" +
                      ",'" + oSub.HMax + "','" + oSub.HMin + "','" + oSub.HAvg + "'" + "," + oSub.HSampleSchemeID + "," + oSub.HSampleQty +
                      "," + oSub.HSampleDamageQty + "," + oSub.HAcceptQty + "," + oSub.HRejectQty + "," + oSub.HSampleUnRightQty + ",'" + oSub.HStatus +
                      "'," + oSub.HUnitID + ",'" + oSub.HInspectVal + "','" + oSub.HTargetVal + "','" + oSub.HUpLimit + "','" + oSub.HDownLimit +
                      "','" + oSub.HUpOffSet + "','" + oSub.HDownOffSet + "'," + oSub.HKeyInspect + ",'" + oSub.HAnalysisMethod + "'," + oSub.HInspectInstruMentID + ",'" + oSub.HInspectResult + "'" + ") ");
                }
                //foreach (Model.ClsQC_OutCompCheckBillSub_Item oSub2 in DetailColl1)
                //{
@@ -249,18 +305,21 @@
                //omodel.HSupID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSupID"]);
                //omodel.HEmpID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HEmpID"]);
                //omodel.HMangerID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMangerID"]);
                omodel.HCusID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCusID"]);
                omodel.HSourceID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSourceID"]);
                omodel.HICMOInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HICMOInterID"]);
                omodel.HICMOBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HICMOBillNo"]);
                omodel.HICMOQty = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HICMOQty"]); ;
                omodel.HProcExchInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HProcExchInterID"]);
                omodel.HProcExchEntryID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HProcExchEntryID"]);
                omodel.HProcExchBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HProcExchBillNo"]);
                omodel.HProcExchQty = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HProcExchQty"]);
                omodel.HMaterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMaterID"]);
                omodel.HInStockQty = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HInStockQty"]);
                omodel.HCheckQty = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckQty"]);
                omodel.HRightQty = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HRightQty"]);
                omodel.HBadQty = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HBadQty"]);
                omodel.HFirstCheckEmp = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HFirstCheckEmp"]);
                omodel.HCheckerResult = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HCheckerResult"]);
                omodel.HLastResult = DBUtility.ClsPub.isBool(Ds.Tables[0].Rows[0]["HLastResult"]);
                //omodel.HRedBlueFlag = DBUtility.ClsPub.isBool(Ds.Tables[0].Rows[0]["HRedBlueFlag"]);
                //
                //循环
                DataSet DsSub ;
                DsSub = oCn.RunProcReturn("Select * from QC_OutCompCheckBillSub Where HInterID=" + lngBillKey.ToString() + " order by HEntryID ", "QC_OutCompCheckBillSub");
@@ -283,10 +342,14 @@
                    oSub.HRelationQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationQty"]);
                    oSub.HRelationMoney = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationMoney"]);
                    //===================================================
                    oSub.HQCCheckClassID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HQCCheckClassID"]);
                    oSub.HQCCheckItemID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HQCCheckItemID"]);
                    oSub.HQCStd = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HQCStd"]);
                    oSub.HResult = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HResult"]);
                    oSub.HUnit = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HUnit"]);
                    oSub.HQCNote = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HQCNote"]);
                    oSub.HResult = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HResult"]);
                    oSub.HMax = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HMax"]);
                    oSub.HMin = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HMin"]);
                    oSub.HAvg = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HAvg"]);
                    //oSub.HDotCheckItemID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HDotCheckItemID"]);
                    //oSub.HDotCheckItem = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HDotCheckItem"]);
                    //oSub.HDotCheckPart = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HDotCheckPart"]);
@@ -320,7 +383,7 @@
                    //oSub.HSeOrderInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSeOrderInterID"]);
                    //oSub.HSeOrderEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSeOrderEntryID"]);
                    //oSub.HSeOrderBillNo = DsSub.Tables[0].Rows[i]["HSeOrderBillNo"].ToString().Trim();
                    DetailColl.Add(oSub);
                }
                //DataSet DsSub2;