| | |
| | | { |
| | | public class ClsSc_MESEndWorkBill:DBUtility.ClsXt_BaseBill |
| | | { |
| | | public Model.ClsSc_MESEndWorkBillMain omodel = new Model.ClsSc_MESEndWorkBillMain(); |
| | | public List<Model.ClsSc_MESEndWorkBillSub> DetailColl = new List<Model.ClsSc_MESEndWorkBillSub>(); |
| | | //public List<Model.ClsSc_MESEndWorkBillSub_Item> DetailColl1 = new List<Model.ClsSc_MESEndWorkBillSub_Item>(); |
| | | public Models.ClsSc_MESEndWorkBillMain omodel = new Models.ClsSc_MESEndWorkBillMain(); |
| | | public List<Models.ClsSc_MESEndWorkBillSub> DetailColl = new List<Models.ClsSc_MESEndWorkBillSub>(); |
| | | //public List<Models.ClsSc_MESEndWorkBillSub_Item> DetailColl1 = new List<Models.ClsSc_MESEndWorkBillSub_Item>(); |
| | | public ClsSc_MESEndWorkBill() |
| | | { |
| | | base.MvarItemKeySub = "Sc_MESEndWorkBillSub"; |
| | |
| | | { |
| | | // |
| | | oCn.BeginTran(); |
| | | string sql = string.Format(@"UpDate Sc_MESEndWorkBillMain set " + |
| | | " HBillNo='" + omodel.HBillNo + "'" + //固定赋值=============== |
| | | ",HDate='" + omodel.HDate + "'" + |
| | | ",HYear='" + omodel.HYear.ToString() + "'" + |
| | | ",HPeriod='" + omodel.HPeriod.ToString() + "'" + |
| | | ",HBillStatus='" + omodel.HBillStatus + "'" + |
| | | ",HRemark='" + omodel.HRemark + "'" + |
| | | //",HBacker='"+omodel.HBacker+"'"+ |
| | | //",HBackDate='" + omodel.HBackDate + "'" + |
| | | //",HBackRemark='"+omodel.HBackRemark+"'"+ |
| | | //",HChecker='" + omodel.HChecker + "'" + |
| | | //",HCheckDate='" + omodel.HCheckDate + "'" + |
| | | //",HMaker='" + omodel.HMaker + "'" + |
| | | //",HMakeDate='" + omodel.HMakeDate + "'" + |
| | | ",HUpDater='" + omodel.HMaker + "'" + |
| | | ",HUpDateDate=getdate()" + |
| | | //",HCloseMan='" + omodel.HCloseMan + "'" + |
| | | //",HCloseDate='" + omodel.HCloseDate + "'" + |
| | | //",HCloseType="+omodel.HCloseType.ToString()+ |
| | | //",HDeleteMan='" + omodel.HDeleteMan + "'" + |
| | | //",HDeleteDate='" + omodel.HDeleteDate + "'" + |
| | | ",HPrintQty=" + omodel.HPrintQty.ToString() + |
| | | //======================================== |
| | | //",HSupID=" + omodel.HSupID.ToString() + |
| | | //",HEmpID=" + omodel.HEmpID.ToString() + |
| | | ",HICMOInterID=" + omodel.HICMOInterID.ToString() + |
| | | ",HICMOBillNo='" + omodel.HICMOBillNo + "'" + |
| | | ",HProcPlanInterID=" + omodel.HProcPlanInterID.ToString() + |
| | | ",HProcPlanEntryID=" + omodel.HProcPlanEntryID.ToString() + |
| | | ",HProcPlanBillNo='" + omodel.HProcPlanBillNo + "'" + |
| | | ",HProcExchInterID=" + omodel.HProcExchInterID.ToString() + |
| | | ",HProcExchEntryID=" + omodel.HProcExchEntryID.ToString() + |
| | | ",HProcExchBillNo='" + omodel.HProcExchBillNo + "'" + |
| | | ",HMaterID=" + omodel.HMaterID.ToString() + |
| | | ",HProcID=" + omodel.HProcID.ToString() + |
| | | ",HICMOQty=" + omodel.HICMOQty.ToString() + |
| | | ",HPlanQty=" + omodel.HPlanQty.ToString() + |
| | | ",HEndWorkTime='" + omodel.HEndWorkTime + "'" + |
| | | ",HSourceID=" + omodel.HSourceID.ToString() + |
| | | ",HGroupID=" + omodel.HGroupID.ToString() + |
| | | ",HDeptID=" + omodel.HDeptID.ToString() + |
| | | ",HEmpID=" + omodel.HEmpID.ToString() + |
| | | ",HQty=" + omodel.HQty.ToString() + |
| | | ",HBadCount=" + omodel.HBadCount.ToString() + |
| | | ",HWasterQty=" + omodel.HWasterQty.ToString() + |
| | | ",HWasterQty2=" + omodel.HWasterQty2.ToString() + |
| | | ",HSelfBadCount=" + omodel.HSelfBadCount.ToString() + |
| | | ",HPieceQty=" + omodel.HPieceQty.ToString() + |
| | | ",HReportType='" + omodel.HReportType + "'" + |
| | | ",HBarCode='" + omodel.HBarCode + "'" + |
| | | ",HAddr='" + omodel.HAddr + "'" + |
| | | ",HBarCodeMaker='" + omodel.HBarCodeMaker + "'" + |
| | | ",HBarCodeMakeDate='" + omodel.HBarCodeMakeDate + "' where HInterID=" + lngBillKey.ToString()+""); |
| | | //更新主表 |
| | | oCn.RunProc("UpDate Sc_MESEndWorkBillMain set " + |
| | | " HBillNo='" + omodel.HBillNo + "'" + //固定赋值=============== |
| | |
| | | //",HCheckDate='" + omodel.HCheckDate + "'" + |
| | | //",HMaker='" + omodel.HMaker + "'" + |
| | | //",HMakeDate='" + omodel.HMakeDate + "'" + |
| | | ",HUpDater='" + omodel.HMaker + "'" + |
| | | ",HUpDater='" + omodel.HUpDater + "'" + |
| | | ",HUpDateDate=getdate()" + |
| | | //",HCloseMan='" + omodel.HCloseMan + "'" + |
| | | //",HCloseDate='" + omodel.HCloseDate + "'" + |
| | |
| | | DeleteBillSub(lngBillKey); |
| | | //插入子表 |
| | | omodel.HInterID = lngBillKey; |
| | | foreach (Model.ClsSc_MESEndWorkBillSub oSub in DetailColl) |
| | | foreach (Models.ClsSc_MESEndWorkBillSub oSub in DetailColl) |
| | | { |
| | | //oCn.RunProc("Insert into Sc_MESEndWorkBillSub " + |
| | | // " (HInterID,HBillNo_bak,HEntryID,HCloseMan" + |
| | |
| | | oCn.RunProc("Insert Into Sc_MESEndWorkBillMain " + |
| | | "(HBillType,HBillSubType,HInterID,HBillNo,HBillStatus,HDate,HMaker,HMakeDate" + |
| | | ",HYear,HPeriod,HRemark" + |
| | | ",HICMOInterID,HICMOBillNo,HProcPlanInterID,HProcPlanEntryID,HProcPlanBillNo,HProcExchInterID,HProcExchEntryID" + |
| | | ",HICMOInterID,HICMOEntryID,HICMOBillNo,HProcPlanInterID,HProcPlanEntryID,HProcPlanBillNo,HProcExchInterID,HProcExchEntryID" + |
| | | ",HProcExchBillNo,HMaterID,HProcID,HICMOQty,HPlanQty,HEndWorkTime,HSourceID" + |
| | | ",HGroupID,HDeptID,HEmpID,HBarCode,HAddr,HBarCodeMaker,HBarCodeMakeDate" + |
| | | ",HQty,HBadCount,HWasterQty,HWasterQty2,HSelfBadCount,HPieceQty"+ |
| | | ",HSourceInterID_Main,HSourceEntryID_Main,HSourceBillNo_Main,HSourceBillType_Main" + |
| | | ",HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HMainSourceBillType" + |
| | | ",HQty,HBadCount,HWasterQty,HWasterQty2,HSelfBadCount,HPieceQty" + |
| | | ") " + |
| | | " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "'," + omodel.HBillStatus.ToString() + ",getdate(),'" + omodel.HMaker + "',getdate()" + |
| | | "," + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "'" + |
| | | "," + omodel.HICMOInterID.ToString() + ",'" + omodel.HICMOBillNo + "'," + omodel.HProcPlanInterID.ToString() + "," + omodel.HProcPlanEntryID.ToString() + ",'" + omodel.HProcPlanBillNo + "'," + omodel.HProcExchInterID.ToString() + "," + omodel.HProcExchEntryID.ToString() + |
| | | "," + omodel.HICMOInterID.ToString() + ",'" + omodel.HICMOEntryID + "','" + omodel.HICMOBillNo + "'," + omodel.HProcPlanInterID.ToString() + "," + omodel.HProcPlanEntryID.ToString() + ",'" + omodel.HProcPlanBillNo + "'," + omodel.HProcExchInterID.ToString() + "," + omodel.HProcExchEntryID.ToString() + |
| | | ",'" + omodel.HProcExchBillNo + "'," + omodel.HMaterID.ToString() + "," + omodel.HProcID.ToString() + "," + omodel.HICMOQty.ToString() + "," + omodel.HPlanQty.ToString() + ",getdate()," + omodel.HSourceID.ToString() + |
| | | "," + omodel.HGroupID.ToString() + "," + omodel.HDeptID.ToString() + "," + omodel.HEmpID.ToString() + ",'" + omodel.HBarCode + "','" + omodel.HAddr + "','" + omodel.HBarCodeMaker + "',getdate()" + |
| | | "," + omodel.HSourceInterID_Main.ToString() + "," + omodel.HSourceEntryID_Main.ToString() + "," + omodel.HSourceBillNo_Main.ToString() + ",'" + omodel.HSourceBillType_Main + "'" + |
| | | "," + omodel.HMainSourceInterID.ToString() + "," + omodel.HMainSourceEntryID.ToString() + "," + omodel.HMainSourceBillNo.ToString() + ",'" + omodel.HMainSourceBillType + "'" + |
| | | "," + omodel.HQty.ToString() + "," + omodel.HBadCount.ToString() + "," + omodel.HWasterQty.ToString() + "," + omodel.HWasterQty2.ToString() + "," + omodel.HSelfBadCount.ToString() + "," + omodel.HPieceQty.ToString() + |
| | | ") "); |
| | | //插入子表 |
| | | foreach (Model.ClsSc_MESEndWorkBillSub oSub in DetailColl) |
| | | { |
| | | //oCn.RunProc("Insert into Sc_MESEndWorkBillSub " + |
| | | // " (HInterID,HBillNo_bak,HEntryID,HCloseMan" + |
| | | // ",HEntryCloseDate,HCloseType,HRemark,HSourceInterID" + |
| | | // ",HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + |
| | | // ",HDotCheckItemID,HDotCheckItem,HDotCheckPart,HClaim,HManagerID" + |
| | | |
| | | // ") 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.HDotCheckItemID.ToString() + ",'" + oSub.HDotCheckItem + "','" + oSub.HDotCheckPart + "','" + oSub.HClaim + "'," + oSub.HManagerID.ToString() + |
| | | // ") "); |
| | | } |
| | | //foreach (Model.ClsSc_MESEndWorkBillSub_Item oSub2 in DetailColl1) |
| | | //{ |
| | | // oCn.RunProc("Insert into Sc_MESEndWorkBillSub_Item " + |
| | | // " (HInterID,HBillNo_bak,HEntryID,HCloseMan" + |
| | | // ",HEntryCloseDate,HCloseType,HRemark,HSourceInterID" + |
| | | // ",HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + |
| | | // ",HMaintainItemID,HMaintainItem,HMaintainPart,HClaim,HManagerID" + |
| | | |
| | | // ") values(" |
| | | // + omodel.HInterID.ToString() + ",'" + oSub2.HBillNo_bak + "'," + oSub2.HEntryID.ToString() + ",'" + oSub2.HCloseMan + "'" + |
| | | // ",getdate()," + Convert.ToString(oSub2.HCloseType ? 1 : 0) + ",'" + oSub2.HRemark + "'," + oSub2.HSourceInterID.ToString() + |
| | | // "," + oSub2.HSourceEntryID.ToString() + ",'" + oSub2.HSourceBillNo + "','" + oSub2.HSourceBillType + "'," + oSub2.HRelationQty.ToString() + "," + oSub2.HRelationMoney.ToString() + |
| | | // "," + oSub2.HMaintainItemID.ToString() + ",'" + oSub2.HMaintainItem + "','" + oSub2.HMaintainPart + "','" + oSub2.HClaim + "'," + oSub2.HManagerID.ToString() + |
| | | // ") "); |
| | | //} |
| | | // |
| | | //foreach (Model.ClsSc_MESEndWorkBillSub oSub in DetailColl) |
| | | //{ |
| | | // Ds = oCn.RunProcReturn("exec h_p_Sc_MESEndWorkBill_Qty " + oSub.HICMOInterID, ""); |
| | | // if (Ds.Tables[0].Rows.Count == 0) |
| | | // return; |
| | | // if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y") |
| | | // { |
| | | // sReturn = "汇报数量超过计划数量!不允许保存"; |
| | | // return false; |
| | | // } |
| | | //} |
| | | // |
| | | |
| | | |
| | | sReturn = "新增单据成功!"; |
| | | oCn.Commit(); |
| | | return true; |
| | |
| | | DetailColl.Clear();//清空 |
| | | for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++) |
| | | { |
| | | Model.ClsSc_MESEndWorkBillSub oSub = new Model.ClsSc_MESEndWorkBillSub(); |
| | | Models.ClsSc_MESEndWorkBillSub oSub = new Models.ClsSc_MESEndWorkBillSub(); |
| | | // 固定赋值=============================================== |
| | | //oSub.HInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HInterID"]); |
| | | //oSub.HEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HEntryID"]); |