using System; using System.Collections.Generic; using System.Text; using System.Data; namespace DAL { public class ClsSc_StationOutBill:DBUtility.ClsXt_BaseBill { public Model.ClsSc_StationOutBillMain omodel = new Model.ClsSc_StationOutBillMain(); public List DetailColl = new List(); public List DetailColl1 = new List(); public ClsSc_StationOutBill() { base.MvarItemKeySub = "Sc_StationOutBillSub"; base.MvarItemKeySub2 = ""; base.MvarItemKeySub3 = ""; base.MvarItemKeySub4 = ""; base.MvarItemKey="Sc_StationOutBillMain"; base.MvarReportTitle="出站记录表"; base.BillType="3791"; base.HBillSubType = "3791"; } #region 固定代码 ~ClsSc_StationOutBill() { DetailColl = null; } #endregion 自定义方法 public bool ShowEmpByGroup(Int64 HGroupID , ref string sReturn, bool bBack) { try { //查询主表 DataSet Ds; Ds = oCn.RunProcReturn("select * from Gy_Employee where HGroupID=" + HGroupID + " ", "Gy_Employee"); if (Ds == null || Ds.Tables[0].Rows.Count == 0) { sReturn = "没有对应的员工!"; return false; } //固定赋值=========================================== DetailColl.Clear();//清空 for (int i = 0; i < Ds.Tables[0].Rows.Count; i++) { Model.ClsSc_StationOutBillSub oSub = new Model.ClsSc_StationOutBillSub(); // 固定赋值=============================================== //=================================================== oSub.HEmpID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[i]["HItemID"]); DetailColl.Add(oSub); } sReturn = "显示单据成功!"; return true; } catch (Exception e) { sReturn = e.Message; throw (e); } } //修改单据 public override bool ModifyBill(Int64 lngBillKey, ref string sReturn) { try { // oCn.BeginTran(); // oCn.RunProc("exec h_p_Mes_ProcessExchangeRelationQty_Out " + lngBillKey.ToString() + ",-1"); // //更新主表 oCn.RunProc("UpDate Sc_StationOutBillMain set " + "HUpDater='" + DBUtility.ClsPub.CurUserName + "'" + ",HUpDateDate=getdate()" + //======================================== ",HSourceName='" + omodel.HSourceName + "'" + ",HRemark='" + omodel.HRemark + "'" + ",HQCCheckID=" + omodel.HQCCheckID.ToString() + ",HEmpID=" + omodel.HEmpID.ToString() + ",HEmpID2=" + omodel.HEmpID2.ToString() + ",HEmpID3=" + omodel.HEmpID3.ToString() + ",HEmpID4=" + omodel.HEmpID4.ToString() + ",HEmpID5=" + omodel.HEmpID5.ToString() + ",HSourceID=" + omodel.HSourceID.ToString() + ",HSourceID2=" + omodel.HSourceID2.ToString() + ",HSourceID3=" + omodel.HSourceID3.ToString() + ",HSourceID4=" + omodel.HSourceID4.ToString() + ",HSourceID5=" + omodel.HSourceID5.ToString() + ",HPayProcID=" + omodel.HPayProcID.ToString() + ",HWorkTimes=" + omodel.HWorkTimes.ToString() + ",HSaveBillFlag=0 " + ",HPieceQty=" + omodel.HPieceQty.ToString() + ",HQty=" + omodel.HQty.ToString() + ",HDSQty=" + omodel.HDSQty.ToString() + ",HChongQty=" + omodel.HChongQty.ToString() + ",HMouldNum='" + omodel.HMouldNum.ToString() + "'" + ",HSourceNameList='" + omodel.HSourceNameList.ToString() + "'" + ",HWasterQty=" + omodel.HWasterQty.ToString() + ",HBadCount=" + omodel.HBadCount.ToString() + ",HLastSubProc=" + Convert.ToString(omodel.HLastSubProc ? 1 : 0) + " where HInterID=" + lngBillKey.ToString()); //删除关联 //DeleteRelation(ref sReturn, lngBillKey); //删除子表 oCn.RunProc("delete Sc_StationOutBillSub where HInterID=" + lngBillKey); //oCn.RunProc("delete Sc_StationOutBillSub_Item where HInterID=" + lngBillKey); //插入子表 omodel.HInterID = lngBillKey; //插入子表 foreach (Model.ClsSc_StationOutBillSub oSub in DetailColl) { oCn.RunProc("Insert into Sc_StationOutBillSub " + " (HInterID,HBillNo_bak,HEntryID,HCloseMan" + ",HEntryCloseDate,HCloseType,HRemark,HSourceInterID" + ",HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + ",HProcNo,HProcID,HMaterID,HEmpID,HSourceID,HQty,HPieceQty" + ",HTimes,HCheckQty,HBadCount,HWasterQty,HWasterQty2,HWeight,HSourceName" + ",HPrice,HMoney,HOtherDeduct,HRelPay,HOtherItem1,HOtherItem2,HCheckEmpID" + ",HProcExchInterID,HProcExchEntryID,HProcExchBillNo" + ",HICMOInterID,HICMOBillNo" + ",HProcPlanInterID,HProcPlanEntryID,HProcPlanBillNo" + ",HWWOrderInterID,HWWOrderEntryID,HWWOrderBillNo" + ",HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" + ") 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.HProcNo.ToString() + "," + oSub.HProcID.ToString() + "," + oSub.HMaterID + "," + oSub.HEmpID + "," + oSub.HSourceID + "," + oSub.HQty.ToString() + "," + oSub.HPieceQty.ToString() + "," + oSub.HTimes.ToString() + "," + oSub.HCheckQty + "," + oSub.HBadCount + "," + oSub.HWasterQty + "," + oSub.HWasterQty2.ToString() + "," + oSub.HWeight.ToString() + ",'" + oSub.HSourceName + "'" + "," + oSub.HPrice.ToString() + "," + oSub.HMoney + "," + oSub.HOtherDeduct + "," + oSub.HRelPay + ",'" + oSub.HOtherItem1 + "','" + oSub.HOtherItem2 + "'," + oSub.HCheckEmpID.ToString() + "," + oSub.HProcExchInterID.ToString() + "," + oSub.HProcExchEntryID + ",'" + oSub.HProcExchBillNo + "'" + "," + oSub.HICMOInterID.ToString() + ",'" + oSub.HICMOBillNo + "'" + "," + oSub.HProcPlanInterID.ToString() + "," + oSub.HProcPlanEntryID + ",'" + oSub.HProcPlanBillNo + "'" + "," + oSub.HWWOrderInterID.ToString() + "," + oSub.HWWOrderEntryID + ",'" + oSub.HWWOrderBillNo + "'" + "," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID + ",'" + oSub.HSeOrderBillNo + "'" + ") "); } //foreach (Model.ClsSc_StationOutBillSub_Item oSub2 in DetailColl1) //{ // oCn.RunProc("Insert into Sc_StationOutBillSub_Item " + // " (HInterID,HBillNo_bak,HEntryID" + // ",HProcNo,HTechParamID,HTechParamUnitID,HValue,HStd,HType" + // ") values(" // + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "'," + oSub2.HEntryID.ToString() + // "," + oSub2.HProcNo.ToString() + "," + oSub2.HTechParamID + "," + oSub2.HTechParamUnitID + ",'" + oSub2.HValue + "','" + oSub2.HStd + "','" + oSub2.HType.ToString() + "'" + // ") "); //} //根据进站单内码 控制进站数量(进站按计划数量控制(暂时不要))(进站数量 按上道工序 合计出站数量控制、且不能小于 本道工序 合计出站数量)) DataSet Ds; Ds = oCn.RunProcReturn("exec h_p_MES_StationOutBill_QtyCtrl " + omodel.HInterID.ToString() + "", "h_p_MES_StationOutBill_QtyCtrl"); if (Ds == null) { sReturn = "判断数量失败!"; oCn.RollBack(); return false; } if (Ds.Tables[0].Rows.Count == 0) { sReturn = "判断数量失败!"; oCn.RollBack(); return false; } if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBack"]) == "2") { sReturn = "判断数量失败!" + DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBackRemark"]); oCn.RollBack(); return false; } ////// oCn.RunProc("exec h_p_Mes_ProcessExchangeRelationQty_Out " + omodel.HInterID.ToString() + ",1"); oCn.RunProc("exec h_p_Mes_ProcessExchangeChangeStatus " + omodel.HInterID.ToString() + " "); //修改单据 不再变码 //oCn.RunProc("exec h_p_Mes_StationOutBillBackBarCode " + omodel.HInterID.ToString() + " "); // //判断是否是 末道工序 DataSet ds1; ds1 = oCn.RunProcReturn(" select HLastProc,HFstProc from Sc_ProcessExchangeBillMain a " + " inner join Sc_ProcessExchangeBillSub b on a.HInterID=b.HInterID " + " Where a.HInterID=" + omodel.HProcExchInterID.ToString() + " and b.HEntryID=" + omodel.HProcExchEntryID.ToString() + " ", "Sc_ProcessExchangeBillMain"); if (ds1 == null || ds1.Tables[0].Rows.Count == 0 || omodel.HLastSubProc==false ) { // } else if (Pub_Class.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HLastProc"]) == "是") { //////拼接JSON 写入CLOUD //DataSet ds2; //ds2 = oCn.RunProcReturn("exec h_p_Sc_GetProdInByStationOutBill_New '" + omodel.HBillNo + "'," + omodel.HCenterID.ToString() + "," + omodel.HProcExchInterID.ToString() + "," + omodel.HQty.ToString(), "h_p_Sc_GetProdInByStationOutBill_New"); //if (ds2 == null || ds2.Tables[0].Rows.Count == 0) //{ // //sReturn = "判断CLOUD关联失败!无法生产CLOUD对应入库单"; // //oCn.RollBack(); // //return false; //} //else //{ // string sJson_BatchNo = ""; // string sJson_BillMain = ""; // string sJson_BillEntry = ""; // if (Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBatchNo"]) == "1") // { // sJson_BatchNo = " \"FLOT\": {\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HLOT"]) + "\"}, \"FLOT_TEXT\":\"" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HLOT"]) + "\" , "; // } // else // { // sJson_BatchNo = " "; // } // string sJson = "{\"Creator\":\"\",\"NeedUpDateFields\":[], \"IsEntryBatchFill\": \"True\", \"Model\": { \"FID\":\"0\", \"FBILLNO\":\"" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBillNO"]) + "\", \"FStockOrgId\":{\"FNumber\":\"201\"}, " + // "\"FPRDORGID\":{\"FNumber\":\"201\"}, \"FOwnerId0\":{\"FNumber\":\"201\"}, \"FBillType\": {\"FNumber\":\"SCRKD02_SYS\" " + // " }, \"FEntity\": [ " + // " { \"FOWNERID\":{\"FNumber\":\"201\"}, \"FSEQ\":\"1\", " + // " \"FMOBILLNO\" : \"" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["hicmobillno"]) + "\" , " + // " \"FMOID\" : " + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HICMOInterID"]) + " , " + // " \"FMOENTRYID\" : " + Pub_Class.ClsPub.isLong(ds2.Tables[0].Rows[0]["HICMOEntryID"]) + " , " + // " \"FMOENTRYSEQ\" : " + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HICMOSubID"]) + " , " + // " \"F_PAEZ_TEXT\":\"" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HOrderProcNo"]) + "\", " + // " \"FSRCBILLTYPE\" : \"PRD_MO\" , \"FSRCBILLNO\" : \"" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HICMOBILLNO"]) + "\" , " + // " \"FSRCINTERID\" : " + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HICMOInterID"]) + " , " + // " \"FSRCENTRYID\" : " + Pub_Class.ClsPub.isLong(ds2.Tables[0].Rows[0]["HICMOENtryID"]) + " , " + // " \"FSRCENTRYSEQ\" : " + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HICMOSubID"]) + " , " + // " \"FMATERIALID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HMaterNumber"]) + "\"} , " + // " \"FWORKSHOPID\": {\"FNumber\":\"02.01\"}, \"FUNITID\": {\"FNumber\":\"009\"}, \"FBASEUNITID\" : {\"FNumber\":\"Pcs\"} , " + // " \"FSTOCKID\": {\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HWHNumber"]) + "\"}, \"FPRODUCTTYPE\" : 1 , " + // " \"FMUSTQty\":" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HQTY"]) + ", " + // " \"FRealQty\":" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HQTY"]) + ", " + // sJson_BatchNo + // " \"FMOMAINENTRYID\":" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["FMOMAINENTRYID"]) + " , " + // " \"FREQSRC\":" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["FREQSRC"]) + " , " + // " \"FREQBILLID\":" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["FREQBILLID"]) + " , " + // " \"FREQBILLNO\":\"" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["FREQBILLNO"]) + "\" , " + // " \"FREQENTRYID\":" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["FREQENTRYID"]) + " , " + // " \"FREQENTRYSEQ\":" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["FREQENTRYSEQ"]) + " , " + // " \"FEntity_Link\": [ { " + // " \"FEntity_Link_FFlowId\":\"f11b462a-8733-40bd-8f29-0906afc6a201\" , " + // " \"FEntity_Link_FFlowLineId\":5 , " + // " \"FEntity_Link_FRuleId\":\"PRD_MO2INSTOCK\" , " + // " \"FEntity_Link_FSTableName\":\"T_PRD_MOENTRY\" , " + // " \"FEntity_Link_FSBillId\":" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HICMOInterID"]) + " , " + // " \"FEntity_Link_FSId\":" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HICMOEntryID"]) + " " + // " } ] } , " + // " { \"FOWNERID\":{\"FNumber\":\"201\"}, \"FSEQ\":\"2\", " + // " \"FMOBILLNO\" : \"" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["hicmobillno"]) + "\" , " + // " \"FMOID\" : " + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HICMOInterID"]) + " , " + // " \"FMOENTRYID\" : " + Pub_Class.ClsPub.isLong(ds2.Tables[0].Rows[0]["HICMOEntryID"]) + " , " + // " \"FMOENTRYSEQ\" : " + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HICMOSubID"]) + " , " + // " \"F_PAEZ_TEXT\":\"" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HOrderProcNo"]) + "\", " + // " \"FSRCBILLTYPE\" : \"PRD_MO\" , \"FSRCBILLNO\" : \"" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HICMOBILLNO"]) + "\" , " + // " \"FSRCINTERID\" : " + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HICMOInterID"]) + " , " + // " \"FSRCENTRYID\" : " + Pub_Class.ClsPub.isLong(ds2.Tables[0].Rows[0]["HICMOENtryID"]) + " , " + // " \"FSRCENTRYSEQ\" : " + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HICMOSubID"]) + " , " + // " \"FMATERIALID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HMaterNumber"]) + "\"} , " + // " \"FWORKSHOPID\": {\"FNumber\":\"02.01\"}, \"FUNITID\": {\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["FUNITID"]) + "\"}, \"FBASEUNITID\" : {\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["FBASEUNITID"]) + "\"} , " + // " \"FSTOCKID\": {\"FNumber\":\"009\"}, \"FPRODUCTTYPE\" : 1 , " + // " \"FMUSTQty\":" + omodel.HWasterQty.ToString() + ", " + // " \"FRealQty\":" + omodel.HWasterQty.ToString() + ", " + // sJson_BatchNo + // " \"FMOMAINENTRYID\":" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["FMOMAINENTRYID"]) + " , " + // " \"FREQSRC\":" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["FREQSRC"]) + " , " + // " \"FREQBILLID\":" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["FREQBILLID"]) + " , " + // " \"FREQBILLNO\":\"" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["FREQBILLNO"]) + "\" , " + // " \"FREQENTRYID\":" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["FREQENTRYID"]) + " , " + // " \"FREQENTRYSEQ\":" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["FREQENTRYSEQ"]) + " , " + // " \"FEntity_Link\": [ { " + // " \"FEntity_Link_FFlowId\":\"f11b462a-8733-40bd-8f29-0906afc6a201\" , " + // " \"FEntity_Link_FFlowLineId\":5 , " + // " \"FEntity_Link_FRuleId\":\"PRD_MO2INSTOCK\" , " + // " \"FEntity_Link_FSTableName\":\"T_PRD_MOENTRY\" , " + // " \"FEntity_Link_FSBillId\":" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HICMOInterID"]) + " , " + // " \"FEntity_Link_FSId\":" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HICMOEntryID"]) + " " + // " } ] } " + // " ] }}"; // // // oWeb.WebService1 oweb = new DAL.oWeb.WebService1(); // // // oweb.Url = Pub_Class.ClsPub.HWEBSUrl_CLD; // // // if (oweb.BillToProdIn(omodel.HBillNo, sJson, Pub_Class.ClsPub.HUrl_CLD, Pub_Class.ClsPub.HdbID_CLD, Pub_Class.ClsPub.HUserName_CLD, Pub_Class.ClsPub.HPsd_CLD, ref Pub_Class.ClsPub.sExeReturnInfo)) // { // //return true; // sReturn = "生成入库成功!" + Pub_Class.ClsPub.sExeReturnInfo; // } // else // { // sReturn = "生成入库失败!" + Pub_Class.ClsPub.sExeReturnInfo; // oCn.RollBack(); // return false; // } //} } // sReturn = "修改单据成功!" + 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); //若MAINDI重复则重新获取 oCn.BeginTran(); //主表 oCn.RunProc("Insert Into Sc_StationOutBillMain " + "(HBillType,HBillSubType,HInterID,HBillNo,HBillStatus,HDate,HMaker,HMakeDate,HMouldNum" + ",HYear,HPeriod,HRemark,HSourceName,HPieceQty,HWasterQty,HPlanPieceQty,HBadPNL" + ",HICMOInterID,HICMOBillNo,HProcPlanInterID,HProcPlanEntryID,HProcPlanBillNo,HProcExchInterID,HProcExchEntryID" + ",HProcExchBillNo,HMaterID,HProcID,HICMOQty,HPlanQty,HStationOutTime,HSourceID,HPayProcID" + ",HGroupID,HDeptID,HEmpID,HBarCode,HAddr,HBarCodeMaker,HBarCodeMakeDate,HSourceID2,HSourceID3,HSourceID4,HSourceID5" + ",HSupID,HQty,HPrice,HMoney,HBadCount,HCenterID,HProcNo,HOrderProcNO,HSourceNameList" + ",HMainSourceInterID,HMainSourceBillNo,HMainSourceBillType,HLastSubProc" + ",HEmpID2,HEmpID3,HEmpID4,HEmpID5,HDSQty,HChongQty,HPriceRate,HWorkTimes,HQCCheckID" + ") " + " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "'," + omodel.HBillStatus.ToString() + ",getdate(),'" + DBUtility.ClsPub.CurUserName + "',getdate(),'" + omodel.HMouldNum + "'" + "," + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + omodel.HSourceName + "'," + omodel.HPieceQty.ToString() + "," + omodel.HWasterQty.ToString() + "," + omodel.HPlanPieceQty.ToString() + "," + omodel.HBadPNL.ToString() + "," + omodel.HICMOInterID.ToString() + ",'" + 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() + ",'" + omodel.HStationOutTime + "'," + omodel.HSourceID.ToString() + "," + omodel.HPayProcID.ToString() + "," + omodel.HGroupID.ToString() + "," + omodel.HDeptID.ToString() + "," + omodel.HEmpID.ToString() + ",'" + omodel.HBarCode + "','" + omodel.HAddr + "','" + omodel.HBarCodeMaker + "',getdate()" + "," + omodel.HSourceID2.ToString() + "," + omodel.HSourceID3.ToString() + "," + omodel.HSourceID4.ToString() + "," + omodel.HSourceID5.ToString() + "," + omodel.HSupID.ToString() + "," + omodel.HQty.ToString() + "," + omodel.HPrice.ToString() + "," + omodel.HMoney.ToString() + "," + omodel.HBadCount.ToString() + "," + omodel.HCenterID.ToString() + "," + omodel.HProcNo.ToString() + ",'" + omodel.HOrderProcNO + "'" + ",'" + omodel.HSourceNameList + "'" + "," + omodel.HMainSourceInterID.ToString() + ",'" + omodel.HMainSourceBillNo + "','" + omodel.HMainSourceBillType + "'," + Convert.ToString(omodel.HLastSubProc ? 1 : 0) + "," + omodel.HEmpID2.ToString() + "," + omodel.HEmpID3.ToString() + "," + omodel.HEmpID4.ToString() + "," + omodel.HEmpID5.ToString() + "," + omodel.HDSQty.ToString() + "," + omodel.HChongQty.ToString() + "," + omodel.HPriceRate.ToString() + "," + omodel.HWorkTimes.ToString() + "," + omodel.HQCCheckID.ToString() + ") "); //插入子表 foreach (Model.ClsSc_StationOutBillSub oSub in DetailColl) { oCn.RunProc("Insert into Sc_StationOutBillSub " + " (HInterID,HBillNo_bak,HEntryID,HCloseMan" + ",HEntryCloseDate,HCloseType,HRemark,HSourceInterID" + ",HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + ",HProcNo,HProcID,HMaterID,HEmpID,HSourceID,HQty,HPieceQty" + ",HTimes,HCheckQty,HBadCount,HWasterQty,HWasterQty2,HWeight,HSourceName" + ",HPrice,HMoney,HOtherDeduct,HRelPay,HOtherItem1,HOtherItem2,HCheckEmpID" + ",HProcExchInterID,HProcExchEntryID,HProcExchBillNo" + ",HICMOInterID,HICMOBillNo" + ",HProcPlanInterID,HProcPlanEntryID,HProcPlanBillNo" + ",HWWOrderInterID,HWWOrderEntryID,HWWOrderBillNo" + ",HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" + ") 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.HProcNo.ToString() + "," + oSub.HProcID.ToString() + "," + oSub.HMaterID + "," + oSub.HEmpID + "," + oSub.HSourceID + "," + oSub.HQty.ToString() + "," + oSub.HPieceQty.ToString() + "," + oSub.HTimes.ToString() + "," + oSub.HCheckQty + "," + oSub.HBadCount + "," + oSub.HWasterQty + "," + oSub.HWasterQty2.ToString() + "," + oSub.HWeight.ToString() + ",'" + oSub.HSourceName + "'" + "," + oSub.HPrice.ToString() + "," + oSub.HMoney + "," + oSub.HOtherDeduct + "," + oSub.HRelPay + ",'" + oSub.HOtherItem1+ "','" + oSub.HOtherItem2 + "'," + oSub.HCheckEmpID.ToString() + "," + oSub.HProcExchInterID.ToString() + "," + oSub.HProcExchEntryID + ",'" + oSub.HProcExchBillNo+ "'" + "," + oSub.HICMOInterID.ToString() + ",'" + oSub.HICMOBillNo+ "'" + "," + oSub.HProcPlanInterID.ToString() + "," + oSub.HProcPlanEntryID + ",'" + oSub.HProcPlanBillNo + "'" + "," + oSub.HWWOrderInterID.ToString() + "," + oSub.HWWOrderEntryID + ",'" + oSub.HWWOrderBillNo + "'" + "," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID + ",'" + oSub.HSeOrderBillNo + "'" + ") "); //oCn.RunProc("update Sc_ProcessExchangeBillsub set HRelEndDate='" + omodel.HStationOutTime + "' where HInterID=" + omodel.HProcExchInterID.ToString() + " and HEntryID=" + oSub.HProcExchEntryID.ToString()); } //oCn.RunProc("update Sc_ProcessExchangeBillsub set HRelEndDate='" + omodel.HStationOutTime + "' where HInterID=" + omodel.HProcExchInterID.ToString() + " and HEntryID=" + omodel.HProcExchEntryID.ToString()); foreach (Model.ClsSc_StationOutBillSub_Item oSub2 in DetailColl1) { oCn.RunProc("Insert into Sc_StationOutBillSub_Item " + " (HInterID,HBillNo_bak,HEntryID" + ",HProcNo,HTechParamID,HTechParamUnitID,HValue,HStd,HType" + ") values(" + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "'," + oSub2.HEntryID.ToString() + "," + oSub2.HProcNo.ToString() + "," + oSub2.HTechParamID + "," + oSub2.HTechParamUnitID + ",'" + oSub2.HValue + "','" + oSub2.HStd + "','" + oSub2.HType.ToString() + "'" + ") "); } // //根据进站单内码 控制进站数量(进站按计划数量控制(暂时不要))(进站数量 按上道工序 合计出站数量控制、且不能小于 本道工序 合计出站数量)) DataSet Ds; Ds = oCn.RunProcReturn("exec h_p_MES_StationOutBill_QtyCtrl " + omodel.HInterID.ToString() + "", "h_p_MES_StationOutBill_QtyCtrl"); if (Ds == null) { sReturn = "判断数量失败!"; oCn.RollBack(); return false; } if (Ds.Tables[0].Rows.Count == 0) { sReturn = "判断数量失败!"; oCn.RollBack(); return false; } if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBack"]) == "2") { sReturn ="数量控制," + DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBackRemark"]); oCn.RollBack(); return false; } // oCn.RunProc("exec h_p_Mes_ProcessExchangeRelationQty_Out " + omodel.HInterID.ToString() + ",1"); oCn.RunProc("exec h_p_Mes_ProcessExchangeChangeStatus " + omodel.HInterID.ToString() + " "); oCn.RunProc("exec h_p_Mes_StationOutBillBackBarCode " + omodel.HInterID.ToString() + " "); //判断是否是 末道工序 DataSet ds1; ds1 = oCn.RunProcReturn(" select HLastProc,HFstProc from Sc_ProcessExchangeBillMain a " + " inner join Sc_ProcessExchangeBillSub b on a.HInterID=b.HInterID " + " Where a.HInterID=" + omodel.HProcExchInterID.ToString() + " and b.HEntryID=" + omodel.HProcExchEntryID.ToString() + " ", "Sc_ProcessExchangeBillMain"); if (ds1 == null || ds1.Tables[0].Rows.Count == 0 || omodel.HLastSubProc == false ) { //sReturn = "末道判断失败!"; // } else if (Pub_Class.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HLastProc"]) == "是") { //末道工序生成 ///判断关键件是否领完 //DataSet dsgj; //dsgj = oCn.RunProcReturn("exec h_p_Sc_StationOutBill_KeyMaterCtrl " + omodel.HInterID.ToString(), "h_p_Sc_StationOutBill_KeyMaterCtrl"); //if (dsgj == null) //{ // sReturn = "判断关键件数量失败!"; // oCn.RollBack(); // return false; //} //if (dsgj.Tables[0].Rows.Count == 0) //{ // sReturn = "判断关键件数量失败2!"; // oCn.RollBack(); // return false; //} //if (DBUtility.ClsPub.isStrNull(dsgj.Tables[0].Rows[0]["HBack"]) == "2") //{ // sReturn = "判断关键件数量失败!" + DBUtility.ClsPub.isStrNull(dsgj.Tables[0].Rows[0]["HBackRemark"]); // oCn.RollBack(); // return false; //} //////拼接JSON 写入CLOUD //DataSet ds2; //ds2 = oCn.RunProcReturn("exec h_p_Sc_GetProdInByStationOutBill_New '" + omodel.HBillNo + "'," + omodel.HCenterID.ToString() +", " + omodel.HProcExchInterID.ToString() + "," + omodel.HQty.ToString(), "h_p_Sc_GetProdInByStationOutBill_New"); //if (ds2 == null || ds2.Tables[0].Rows.Count == 0) //{ // //sReturn = "判断CLOUD关联失败!无法生产CLOUD对应入库单"; // //oCn.RollBack(); // //return false; //} //else //{ // string sJson_BatchNo = ""; // string sJson_BillMain = ""; // string sJson_BillEntry = ""; // if (Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBatchNo"]) == "1") // { // sJson_BatchNo = " \"FLOT\": {\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HLOT"]) + "\"}, \"FLOT_TEXT\":\"" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HLOT"]) + "\" , "; // } // else // { // sJson_BatchNo = " "; // } // string sJson = "{\"Creator\":\"\",\"NeedUpDateFields\":[], \"IsEntryBatchFill\": \"True\", \"Model\": { \"FID\":\"0\", \"FBILLNO\":\"" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBillNO"]) + "\", \"FStockOrgId\":{\"FNumber\":\"201\"}, " + // "\"FPRDORGID\":{\"FNumber\":\"201\"}, \"FOwnerId0\":{\"FNumber\":\"201\"}, \"FBillType\": {\"FNumber\":\"SCRKD02_SYS\" " + // " }, \"FEntity\": [ " + // " { \"FOWNERID\":{\"FNumber\":\"201\"}, \"FSEQ\":\"1\", " + // " \"FMOBILLNO\" : \"" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["hicmobillno"]) + "\" , " + // " \"FMOID\" : " + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HICMOInterID"]) + " , " + // " \"FMOENTRYID\" : " + Pub_Class.ClsPub.isLong(ds2.Tables[0].Rows[0]["HICMOEntryID"]) + " , " + // " \"FMOENTRYSEQ\" : " + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HICMOSubID"]) + " , " + // " \"F_PAEZ_TEXT\":\"" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HOrderProcNo"]) + "\", " + // " \"FSRCBILLTYPE\" : \"PRD_MO\" , \"FSRCBILLNO\" : \"" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HICMOBILLNO"]) + "\" , " + // " \"FSRCINTERID\" : " + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HICMOInterID"]) + " , " + // " \"FSRCENTRYID\" : " + Pub_Class.ClsPub.isLong(ds2.Tables[0].Rows[0]["HICMOENtryID"]) + " , " + // " \"FSRCENTRYSEQ\" : " + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HICMOSubID"]) + " , " + // " \"FMATERIALID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HMaterNumber"]) + "\"} , " + // " \"FWORKSHOPID\": {\"FNumber\":\"02.01\"}, \"FUNITID\": {\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["FUNITID"]) + "\"}, \"FBASEUNITID\" : {\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["FBASEUNITID"]) + "\"} , " + // " \"FSTOCKID\": {\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HWHNumber"]) + "\"}, \"FPRODUCTTYPE\" : 1 , " + // " \"FMUSTQty\":" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HQTY"]) + ", " + // " \"FRealQty\":" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HQTY"]) + ", " + // sJson_BatchNo + // " \"FMOMAINENTRYID\":" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["FMOMAINENTRYID"]) + " , " + // " \"FREQSRC\":" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["FREQSRC"]) + " , " + // " \"FREQBILLID\":" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["FREQBILLID"]) + " , " + // " \"FREQBILLNO\":\"" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["FREQBILLNO"]) + "\" , " + // " \"FREQENTRYID\":" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["FREQENTRYID"]) + " , " + // " \"FREQENTRYSEQ\":" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["FREQENTRYSEQ"]) + " , " + // " \"FEntity_Link\": [ { " + // " \"FEntity_Link_FFlowId\":\"f11b462a-8733-40bd-8f29-0906afc6a201\" , " + // " \"FEntity_Link_FFlowLineId\":5 , " + // " \"FEntity_Link_FRuleId\":\"PRD_MO2INSTOCK\" , " + // " \"FEntity_Link_FSTableName\":\"T_PRD_MOENTRY\" , " + // " \"FEntity_Link_FSBillId\":" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HICMOInterID"]) + " , " + // " \"FEntity_Link_FSId\":" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HICMOEntryID"]) + " " + // " } ] } , " + // " { \"FOWNERID\":{\"FNumber\":\"201\"}, \"FSEQ\":\"2\", " + // " \"FMOBILLNO\" : \"" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["hicmobillno"]) + "\" , " + // " \"FMOID\" : " + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HICMOInterID"]) + " , " + // " \"FMOENTRYID\" : " + Pub_Class.ClsPub.isLong(ds2.Tables[0].Rows[0]["HICMOEntryID"]) + " , " + // " \"FMOENTRYSEQ\" : " + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HICMOSubID"]) + " , " + // " \"F_PAEZ_TEXT\":\"" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HOrderProcNo"]) + "\", " + // " \"FSRCBILLTYPE\" : \"PRD_MO\" , \"FSRCBILLNO\" : \"" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HICMOBILLNO"]) + "\" , " + // " \"FSRCINTERID\" : " + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HICMOInterID"]) + " , " + // " \"FSRCENTRYID\" : " + Pub_Class.ClsPub.isLong(ds2.Tables[0].Rows[0]["HICMOENtryID"]) + " , " + // " \"FSRCENTRYSEQ\" : " + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HICMOSubID"]) + " , " + // " \"FMATERIALID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HMaterNumber"]) + "\"} , " + // " \"FWORKSHOPID\": {\"FNumber\":\"02.01\"}, \"FUNITID\": {\"FNumber\":\"009\"}, \"FBASEUNITID\" : {\"FNumber\":\"Pcs\"} , " + // " \"FSTOCKID\": {\"FNumber\":\"009\"}, \"FPRODUCTTYPE\" : 1 , " + // " \"FMUSTQty\":" + omodel.HWasterQty.ToString() + ", " + // " \"FRealQty\":" + omodel.HWasterQty.ToString() + ", " + // sJson_BatchNo + // " \"FMOMAINENTRYID\":" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["FMOMAINENTRYID"]) + " , " + // " \"FREQSRC\":" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["FREQSRC"]) + " , " + // " \"FREQBILLID\":" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["FREQBILLID"]) + " , " + // " \"FREQBILLNO\":\"" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["FREQBILLNO"]) + "\" , " + // " \"FREQENTRYID\":" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["FREQENTRYID"]) + " , " + // " \"FREQENTRYSEQ\":" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["FREQENTRYSEQ"]) + " , " + // " \"FEntity_Link\": [ { " + // " \"FEntity_Link_FFlowId\":\"f11b462a-8733-40bd-8f29-0906afc6a201\" , " + // " \"FEntity_Link_FFlowLineId\":5 , " + // " \"FEntity_Link_FRuleId\":\"PRD_MO2INSTOCK\" , " + // " \"FEntity_Link_FSTableName\":\"T_PRD_MOENTRY\" , " + // " \"FEntity_Link_FSBillId\":" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HICMOInterID"]) + " , " + // " \"FEntity_Link_FSId\":" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HICMOEntryID"]) + " " + // " } ] } " + // " ] }}"; // //6 // oWeb.WebService1 oweb = new DAL.oWeb.WebService1(); // // // oweb.Url = Pub_Class.ClsPub.HWEBSUrl_CLD; // // // if (oweb.BillToProdIn(omodel.HBillNo, sJson, Pub_Class.ClsPub.HUrl_CLD, Pub_Class.ClsPub.HdbID_CLD, Pub_Class.ClsPub.HUserName_CLD, Pub_Class.ClsPub.HPsd_CLD, ref Pub_Class.ClsPub.sExeReturnInfo)) // { // //return true; // } // else // { // sReturn = "生成入库失败!" + Pub_Class.ClsPub.sExeReturnInfo; // oCn.RollBack(); // return false; // } //} } sReturn = "新增单据成功!2"; oCn.Commit(); return true; } catch (Exception e) { sReturn = e.Message; oCn.RollBack(); throw (e); } } //显示单据 public override bool ShowBill(Int64 lngBillKey, ref string sReturn) { try { //查询主表 DataSet Ds ; Ds = oCn.RunProcReturn("Select * from Sc_StationOutBillMain Where HInterID=" + lngBillKey.ToString(), "Sc_StationOutBillMain"); if(Ds.Tables[0].Rows.Count==0) { sReturn = "单据未找到!"; return false; } //固定赋值=========================================== omodel.HInterID =DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"]); omodel.HBillNo = Ds.Tables[0].Rows[0]["HBillNo"].ToString().Trim(); omodel.HDate =DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HDate"]); omodel.HYear = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HYear"]); omodel.HPeriod = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPeriod"]); omodel.HCheckItemNowID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckItemNowID"]); omodel.HCheckItemNextID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckItemNextID"]); omodel.HCheckFlowID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckFlowID"]); omodel.HRemark = Ds.Tables[0].Rows[0]["HRemark"].ToString().Trim(); omodel.HBillStatus = DBUtility.ClsPub.isInt(Ds.Tables[0].Rows[0]["HBillStatus"]); omodel.HBillType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillType"]); omodel.HBillSubType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillSubType"]); omodel.HMaker = Ds.Tables[0].Rows[0]["HMaker"].ToString().Trim(); omodel.HMakeDate = Ds.Tables[0].Rows[0]["HMakeDate"].ToString().Trim(); omodel.HUpDateDate = Ds.Tables[0].Rows[0]["HUpDateDate"].ToString().Trim(); omodel.HUpDater = Ds.Tables[0].Rows[0]["HUpDater"].ToString().Trim(); omodel.HBackDate = Ds.Tables[0].Rows[0]["HBackDate"].ToString().Trim(); omodel.HBacker = Ds.Tables[0].Rows[0]["HBacker"].ToString().Trim(); omodel.HCheckDate = Ds.Tables[0].Rows[0]["HCheckDate"].ToString().Trim(); omodel.HChecker = Ds.Tables[0].Rows[0]["HChecker"].ToString().Trim(); omodel.HCloseDate = Ds.Tables[0].Rows[0]["HCloseDate"].ToString().Trim(); omodel.HCloseMan = Ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim(); omodel.HDeleteDate = Ds.Tables[0].Rows[0]["HDeleteDate"].ToString().Trim(); omodel.HDeleteMan = Ds.Tables[0].Rows[0]["HDeleteMan"].ToString().Trim(); omodel.HMainSourceInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMainSourceInterID"]); omodel.HMainSourceBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMainSourceBillNo"]); //======================================================== ////== omodel.HBadPNL = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HBadPNL"]); //omodel.HWHID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HWHID"]); //omodel.HSCWHID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSCWHID"]); omodel.HSupID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSupID"]); omodel.HQty = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HQty"]); omodel.HPieceQty = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HPieceQty"]); omodel.HPriceRate = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HPriceRate"]); omodel.HPlanPieceQty = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HPlanPieceQty"]); omodel.HBadCount = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HBadCount"]); omodel.HWasterQty = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HWasterQty"]); omodel.HPrice = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HPrice"]); omodel.HMoney = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HMoney"]); //omodel.HEmpID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HEmpID"]); //omodel.HMangerID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMangerID"]); omodel.HICMOInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HICMOInterID"]); omodel.HICMOBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HICMOBillNo"]); omodel.HProcPlanInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HProcPlanInterID"]); omodel.HProcPlanEntryID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HProcPlanEntryID"]); omodel.HProcPlanBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HProcPlanBillNo"]); 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.HMaterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMaterID"]); omodel.HProcID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HProcID"]); omodel.HPayProcID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPayProcID"]); omodel.HICMOQty = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HICMOQty"]); omodel.HPlanQty = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HPlanQty"]); omodel.HDSQty = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HDSQty"]); omodel.HChongQty = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HChongQty"]); omodel.HStationOutTime = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HStationOutTime"]); omodel.HSourceID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSourceID"]); omodel.HGroupID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HGroupID"]); omodel.HDeptID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HDeptID"]); omodel.HEmpID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HEmpID"]); omodel.HEmpID2 = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HEmpID2"]); omodel.HEmpID3 = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HEmpID3"]); omodel.HEmpID4 = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HEmpID4"]); omodel.HEmpID5 = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HEmpID5"]); omodel.HReportType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HReportType"]); omodel.HBarCode = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBarCode"]); omodel.HAddr = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HAddr"]); omodel.HBarCodeMaker = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBarCodeMaker"]); omodel.HBarCodeMakeDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HBarCodeMakeDate"]); //omodel.HRedBlueFlag = DBUtility.ClsPub.isBool(Ds.Tables[0].Rows[0]["HRedBlueFlag"]); omodel.HSourceName = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HSourceName"]); omodel.HCenterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCenterID"]); omodel.HProcNo = DBUtility.ClsPub.isInt(Ds.Tables[0].Rows[0]["HProcNo"]); omodel.HOrderProcNO = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HOrderProcNO"]); omodel.HLastSubProc = DBUtility.ClsPub.isBool(Ds.Tables[0].Rows[0]["HLastSubProc"]); omodel.HWorkTimes = DBUtility.ClsPub.isSingle(Ds.Tables[0].Rows[0]["HWorkTimes"]); omodel.HMouldNum = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMouldNum"]); omodel.HQCCheckID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HQCCheckID"]); omodel.HSourceNameList = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HSourceNameList"]); // //循环 DataSet DsSub ; DsSub = oCn.RunProcReturn("Select * from Sc_StationOutBillSub Where HInterID=" + lngBillKey.ToString(), "Sc_StationOutBillSub"); DetailColl.Clear();//清空 for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++) { Model.ClsSc_StationOutBillSub oSub = new Model.ClsSc_StationOutBillSub(); // 固定赋值=============================================== oSub.HInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HInterID"]); oSub.HEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HEntryID"]); oSub.HBillNo_bak = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HBillNo_bak"]); //oSub.HEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HEntryID"]); oSub.HCloseMan = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HCloseMan"]); oSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HEntryCloseDate"]); oSub.HCloseType = DBUtility.ClsPub.isBool(DsSub.Tables[0].Rows[i]["HCloseType"]); oSub.HRemark = DsSub.Tables[0].Rows[i]["HRemark"].ToString().Trim(); oSub.HSourceInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceInterID"]); oSub.HSourceEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceEntryID"]); oSub.HSourceBillType = DsSub.Tables[0].Rows[i]["HSourceBillType"].ToString().Trim(); oSub.HSourceBillNo = DsSub.Tables[0].Rows[i]["HSourceBillNo"].ToString().Trim(); oSub.HRelationQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationQty"]); oSub.HRelationMoney = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationMoney"]); //=================================================== oSub.HProcID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HProcID"]); oSub.HProcNo = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HProcNo"]); oSub.HMaterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HMaterID"]); oSub.HEmpID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HEmpID"]); oSub.HSourceID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceID"]); oSub.HSourceName = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HSourceName"]); oSub.HRelBeginDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HRelBeginDate"]); oSub.HRelEndDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HRelEndDate"]); oSub.HTimes = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HTimes"]); oSub.HQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HQty"]); oSub.HPieceQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HPieceQty"]); oSub.HCheckQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HCheckQty"]); oSub.HBadCount = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HBadCount"]); oSub.HWasterQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HWasterQty"]); oSub.HWasterQty2 = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HWasterQty2"]); oSub.HWeight = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HWeight"]); oSub.HPrice = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HPrice"]); oSub.HMoney = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HMoney"]); oSub.HOtherDeduct = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HOtherDeduct"]); oSub.HRelPay = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelPay"]); oSub.HOtherItem1 = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HOtherItem1"]); oSub.HOtherItem2 = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HOtherItem2"]); oSub.HCheckEmpID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HCheckEmpID"]); oSub.HProcPlanInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HProcPlanInterID"]); oSub.HProcPlanEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HProcPlanEntryID"]); oSub.HProcPlanBillNo = DsSub.Tables[0].Rows[i]["HProcPlanBillNo"].ToString().Trim(); oSub.HICMOInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HICMOInterID"]); oSub.HICMOBillNo = DsSub.Tables[0].Rows[i]["HICMOBillNo"].ToString().Trim(); oSub.HWWOrderInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HWWOrderInterID"]); oSub.HWWOrderEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HWWOrderEntryID"]); oSub.HWWOrderBillNo = DsSub.Tables[0].Rows[i]["HWWOrderBillNo"].ToString().Trim(); 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(); oSub.HProcExchInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HProcExchInterID"]); oSub.HProcExchEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HProcExchEntryID"]); oSub.HProcExchBillNo = DsSub.Tables[0].Rows[i]["HProcExchBillNo"].ToString().Trim(); DetailColl.Add(oSub); } sReturn = "显示单据成功!"; return true; } catch (Exception e) { sReturn = e.Message; throw (e); } } //审核 public bool CheckBill(Int64 lngBillKey, ref string sReturn) { try { string HChecker = DBUtility.ClsPub.CurUserName; string HCheckDate = DBUtility.ClsPub.GetServerDate(-1); if (ShowBill(lngBillKey, ref Pub_Class.ClsPub.sExeReturnInfo) == false) { sReturn = "审核失败,单据未找到!"; return false; } oCn.BeginTran(); oCn.RunProc(" Update " + MvarItemKey + " set HChecker='" + HChecker + "',HCheckDate='" + HCheckDate + "' Where HInterID=" + lngBillKey.ToString()); ////// //oCn.RunProc("exec h_p_Mes_ProcessExchangeRelationQty_Check_Out " + lngBillKey.ToString() + ",1"); //判断是否是 末道工序 DataSet ds1; ds1 = oCn.RunProcReturn(" select HLastProc,HFstProc from Sc_ProcessExchangeBillMain a " + " inner join Sc_ProcessExchangeBillSub b on a.HInterID=b.HInterID " + " Where a.HInterID=" + omodel.HProcExchInterID.ToString() + " and b.HEntryID=" + omodel.HProcExchEntryID.ToString() + " ", "Sc_ProcessExchangeBillMain"); if (ds1 == null || ds1.Tables[0].Rows.Count == 0 || omodel.HLastSubProc == false) { // } else if (Pub_Class.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HLastProc"]) == "是") { //////拼接JSON 写入CLOUD //DataSet ds2; //ds2 = oCn.RunProcReturn("exec h_p_Sc_GetProdInByStationOutBill_New '" + omodel.HBillNo + "'," + " " + omodel.HProcExchInterID.ToString() + "," + omodel.HQty.ToString(), "h_p_Sc_GetProdInByStationOutBill_New"); //if (ds2 == null || ds2.Tables[0].Rows.Count == 0) //{ // //sReturn = "判断CLOUD关联失败!无法生产CLOUD对应入库单"; // //oCn.RollBack(); // //return false; //} //else //{ // string sJson_BatchNo = ""; // string sJson_BillMain = ""; // string sJson_BillEntry = ""; // if (Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBatchNo"]) == "1") // { // sJson_BatchNo = " \"FLOT\": {\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HLOT"]) + "\"}, \"FLOT_TEXT\":\"" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HLOT"]) + "\" , "; // } // else // { // sJson_BatchNo = " "; // } // string sJson = "{\"Creator\":\"\",\"NeedUpDateFields\":[], \"IsEntryBatchFill\": \"True\", \"Model\": { \"FID\":\"0\", \"FBILLNO\":\"" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBillNO"]) + "\", \"FStockOrgId\":{\"FNumber\":\"201\"}, " + // "\"FPRDORGID\":{\"FNumber\":\"201\"}, \"FOwnerId0\":{\"FNumber\":\"201\"}, \"FBillType\": {\"FNumber\":\"SCRKD02_SYS\" " + // " }, \"FEntity\": [ " + // " { \"FOWNERID\":{\"FNumber\":\"201\"}, \"FSEQ\":\"1\", " + // " \"FMOBILLNO\" : \"" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["hicmobillno"]) + "\" , " + // " \"FMOID\" : " + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HICMOInterID"]) + " , " + // " \"FMOENTRYID\" : " + Pub_Class.ClsPub.isLong(ds2.Tables[0].Rows[0]["HICMOEntryID"]) + " , " + // " \"FMOENTRYSEQ\" : " + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HICMOSubID"]) + " , " + // " \"F_PAEZ_TEXT\":\"" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HOrderProcNo"]) + "\", " + // " \"FSRCBILLTYPE\" : \"PRD_MO\" , \"FSRCBILLNO\" : \"" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HICMOBILLNO"]) + "\" , " + // " \"FSRCINTERID\" : " + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HICMOInterID"]) + " , " + // " \"FSRCENTRYID\" : " + Pub_Class.ClsPub.isLong(ds2.Tables[0].Rows[0]["HICMOENtryID"]) + " , " + // " \"FSRCENTRYSEQ\" : " + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HICMOSubID"]) + " , " + // " \"FMATERIALID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HMaterNumber"]) + "\"} , " + // " \"FWORKSHOPID\": {\"FNumber\":\"02.01\"}, \"FUNITID\": {\"FNumber\":\"009\"}, \"FBASEUNITID\" : {\"FNumber\":\"Pcs\"} , " + // " \"FSTOCKID\": {\"FNumber\":\"006\"}, \"FPRODUCTTYPE\" : 1 , " + // " \"FMUSTQty\":" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HQTY"]) + ", " + // " \"FRealQty\":" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HQTY"]) + ", " + // sJson_BatchNo + // " \"FMOMAINENTRYID\":" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["FMOMAINENTRYID"]) + " , " + // " \"FREQSRC\":" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["FREQSRC"]) + " , " + // " \"FREQBILLID\":" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["FREQBILLID"]) + " , " + // " \"FREQBILLNO\":\"" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["FREQBILLNO"]) + "\" , " + // " \"FREQENTRYID\":" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["FREQENTRYID"]) + " , " + // " \"FREQENTRYSEQ\":" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["FREQENTRYSEQ"]) + " , " + // " \"FEntity_Link\": [ { " + // " \"FEntity_Link_FFlowId\":\"f11b462a-8733-40bd-8f29-0906afc6a201\" , " + // " \"FEntity_Link_FFlowLineId\":5 , " + // " \"FEntity_Link_FRuleId\":\"PRD_MO2INSTOCK\" , " + // " \"FEntity_Link_FSTableName\":\"T_PRD_MOENTRY\" , " + // " \"FEntity_Link_FSBillId\":" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HICMOInterID"]) + " , " + // " \"FEntity_Link_FSId\":" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HICMOEntryID"]) + " " + // " } ] } , " + // " { \"FOWNERID\":{\"FNumber\":\"201\"}, \"FSEQ\":\"2\", " + // " \"FMOBILLNO\" : \"" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["hicmobillno"]) + "\" , " + // " \"FMOID\" : " + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HICMOInterID"]) + " , " + // " \"FMOENTRYID\" : " + Pub_Class.ClsPub.isLong(ds2.Tables[0].Rows[0]["HICMOEntryID"]) + " , " + // " \"FMOENTRYSEQ\" : " + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HICMOSubID"]) + " , " + // " \"F_PAEZ_TEXT\":\"" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HOrderProcNo"]) + "\", " + // " \"FSRCBILLTYPE\" : \"PRD_MO\" , \"FSRCBILLNO\" : \"" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HICMOBILLNO"]) + "\" , " + // " \"FSRCINTERID\" : " + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HICMOInterID"]) + " , " + // " \"FSRCENTRYID\" : " + Pub_Class.ClsPub.isLong(ds2.Tables[0].Rows[0]["HICMOENtryID"]) + " , " + // " \"FSRCENTRYSEQ\" : " + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HICMOSubID"]) + " , " + // " \"FMATERIALID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HMaterNumber"]) + "\"} , " + // " \"FWORKSHOPID\": {\"FNumber\":\"02.01\"}, \"FUNITID\": {\"FNumber\":\"009\"}, \"FBASEUNITID\" : {\"FNumber\":\"Pcs\"} , " + // " \"FSTOCKID\": {\"FNumber\":\"009\"}, \"FPRODUCTTYPE\" : 1 , " + // " \"FMUSTQty\":" + omodel.HWasterQty.ToString() + ", " + // " \"FRealQty\":" + omodel.HWasterQty.ToString() + ", " + // sJson_BatchNo + // " \"FMOMAINENTRYID\":" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["FMOMAINENTRYID"]) + " , " + // " \"FREQSRC\":" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["FREQSRC"]) + " , " + // " \"FREQBILLID\":" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["FREQBILLID"]) + " , " + // " \"FREQBILLNO\":\"" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["FREQBILLNO"]) + "\" , " + // " \"FREQENTRYID\":" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["FREQENTRYID"]) + " , " + // " \"FREQENTRYSEQ\":" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["FREQENTRYSEQ"]) + " , " + // " \"FEntity_Link\": [ { " + // " \"FEntity_Link_FFlowId\":\"f11b462a-8733-40bd-8f29-0906afc6a201\" , " + // " \"FEntity_Link_FFlowLineId\":5 , " + // " \"FEntity_Link_FRuleId\":\"PRD_MO2INSTOCK\" , " + // " \"FEntity_Link_FSTableName\":\"T_PRD_MOENTRY\" , " + // " \"FEntity_Link_FSBillId\":" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HICMOInterID"]) + " , " + // " \"FEntity_Link_FSId\":" + Pub_Class.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HICMOEntryID"]) + " " + // " } ] } " + // " ] }}"; // // // oWeb.WebService1 oweb = new DAL.oWeb.WebService1(); // // // oweb.Url = Pub_Class.ClsPub.HWEBSUrl_CLD; // // // if (oweb.BillToProdIn(omodel.HBillNo, sJson, Pub_Class.ClsPub.HUrl_CLD, Pub_Class.ClsPub.HdbID_CLD, Pub_Class.ClsPub.HUserName_CLD, Pub_Class.ClsPub.HPsd_CLD, ref Pub_Class.ClsPub.sExeReturnInfo)) // { // //return true; // sReturn = "生成入库成功!" + Pub_Class.ClsPub.sExeReturnInfo; // } // else // { // sReturn = "生成入库失败!" + Pub_Class.ClsPub.sExeReturnInfo; // oCn.RollBack(); // return false; // } //} } // sReturn = sReturn + " 审核功能!"; oCn.Commit(); return true; } catch (Exception e) { sReturn = e.Message; oCn.RollBack(); return false; } } //反审核 public bool AbandonCheck(Int64 lngBillKey, ref string sReturn) { if (isUse(lngBillKey, ref sReturn)) { return false; } try { if (ShowBill(lngBillKey, ref Pub_Class.ClsPub.sExeReturnInfo) == false) { sReturn = "反审核失败,单据未找到!"; return false; } oCn.BeginTran(); oCn.RunProc(" Update " + MvarItemKey + " set HChecker='',HCheckDate=null Where HInterID=" + lngBillKey.ToString()); ////// //oCn.RunProc("exec h_p_Mes_ProcessExchangeRelationQty_Check_Out " + lngBillKey.ToString() + ",-1"); //判断是否是 末道工序 DataSet ds1; ds1 = oCn.RunProcReturn(" select HLastProc,HFstProc from Sc_ProcessExchangeBillMain a " + " inner join Sc_ProcessExchangeBillSub b on a.HInterID=b.HInterID " + " Where a.HInterID=" + omodel.HProcExchInterID.ToString() + " and b.HEntryID=" + omodel.HProcExchEntryID.ToString() + " ", "Sc_ProcessExchangeBillMain"); if (ds1 == null || ds1.Tables[0].Rows.Count == 0 || omodel.HLastSubProc == false) { // } else if (Pub_Class.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HLastProc"]) == "是") { //oWeb.WebService1 oweb = new DAL.oWeb.WebService1(); //// //oweb.Url = Pub_Class.ClsPub.HWEBSUrl_CLD; //// //if (oweb.DelBillProdIn(omodel.HBillNo, Pub_Class.ClsPub.HUrl_CLD, Pub_Class.ClsPub.HdbID_CLD, Pub_Class.ClsPub.HUserName_CLD, Pub_Class.ClsPub.HPsd_CLD, ref Pub_Class.ClsPub.sExeReturnInfo)) //{ // //return true; //} //else //{ // sReturn = "反审核失败,删除入库单失败!"; // return false; //} } sReturn = sReturn + " 反审核功能!"; oCn.Commit(); return true; } catch (Exception e) { sReturn = e.Message; oCn.RollBack(); return false; ; } } //判断如果接收数量不等于发出数量时是否存在不合格评审单 public bool CheckHaveNoPass(Int64 lngBillKey, ref string sReturn) { DataSet Ds; Ds = oCn.RunProcReturn("exec h_p_MES_CheckHaveNoPass " + lngBillKey, "h_p_MES_CheckHaveNoPass"); if (Ds.Tables[0].Rows[0][0].ToString() == "no") { sReturn = "未提交MRB评审单"; return false; } return true; } public bool DeleteCheck(long HInterID,string HType, ref string sReturn) { DataSet Ds; Ds = oCn.RunProcReturn("exec h_p_Sc_StationDelete " + HInterID + ",'" + HType+"'", "h_p_Sc_StationDelete"); if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0][0]) != "OK") { sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0][0]); return false; } return true; } public bool UpDatePayMent(string HBillNo, double sPayMent,string sType, ref string sReturn) { try { if (sType == "1") { oCn.RunProc("Update Sc_StationOutBillMain set HMoney=" + sPayMent.ToString() + " WHere HBillNo='" + HBillNo + "' "); } if (sType == "2") { oCn.RunProc("Update Sc_StationOutBillMain set HMoney2=" + sPayMent.ToString() + " WHere HBillNo='" + HBillNo + "' "); } if (sType == "3") { oCn.RunProc("Update Sc_StationOutBillMain set HMoney3=" + sPayMent.ToString() + " WHere HBillNo='" + HBillNo + "' "); } if (sType == "4") { oCn.RunProc("Update Sc_StationOutBillMain set HMoney4=" + sPayMent.ToString() + " WHere HBillNo='" + HBillNo + "' "); } if (sType == "5") { oCn.RunProc("Update Sc_StationOutBillMain set HMoney5=" + sPayMent.ToString() + " WHere HBillNo='" + HBillNo + "' "); } return true; } catch (Exception e) { sReturn = e.Message; return false; } } public bool DeleteBill(long HInterID, long HProcExchInterID, long HProcExchEntryID, ref string sReturn) { try { oCn.BeginTran(); //删除关联 // oCn.RunProc("exec h_p_Mes_ProcessExchangeRelationQty_Out " + HInterID.ToString() + ",-1"); // oCn.RunProc("delete Sc_StationOutBillMain where HInterID=" + HInterID); oCn.RunProc("delete Sc_StationOutBillSub where HInterID=" + HInterID); //oCn.RunProc("delete Sc_StationOutBillSub_Item where HInterID=" + HInterID); //oCn.RunProc("update Sc_ProcessExchangeBillsub set HRelEndDate=null where HInterID=" + HProcExchInterID + " and HEntryID=" + HProcExchEntryID); oCn.Commit(); return true; } catch (Exception e) { sReturn = e.Message; oCn.RollBack(); throw (e); } } public bool CheckCenterIDByUser(long HCenterID) { DataSet Ds; Ds = oCn.RunProcReturn("select 1 from MES_CenterIDByUser where HUserID='" + DBUtility.ClsPub.CurUserID + "' and HCenterID=" + HCenterID, "h_p_Sc_StationDelete"); if (Ds == null || Ds.Tables[0].Rows.Count == 0) { return false; } return true; } //品质确认 审核 public bool CheckBill_PZ(Int64 lngBillKey, string HChecker, ref string sReturn) { try { string HCheckDate = DBUtility.ClsPub.GetServerDate(-1); oCn.RunProc(" Update " + MvarItemKey + " set HChecker='" + HChecker + "',HCheckDate='" + HCheckDate + "' Where HInterID=" + lngBillKey.ToString()); sReturn = ""; return true; } catch (Exception e) { sReturn = e.Message; throw (e); } } //返回是否需要IPQC确认 public bool IPQCCheckByStationOut(Int64 lngBillKey, ref string sIsMainLot, ref bool sIsIPQCCheck, ref string sReturn) { try { //IPQC确认 DataSet DsIPQC; DsIPQC = oCn.RunProcReturn("exec h_p_MES_IPQCCheckByStationOut " + lngBillKey, "h_p_MES_IPQCCheckByStationOut"); if (DsIPQC.Tables[0].Rows.Count > 0) { sIsMainLot = DsIPQC.Tables[0].Rows[0]["HIsMainLot"].ToString(); sIsIPQCCheck =DBUtility.ClsPub.isBool( DsIPQC.Tables[0].Rows[0]["HIPQCCheck"]); } return true; } catch (Exception e) { sReturn = e.Message; throw (e); } } public bool DelBillProdIn(Int64 HInterID,string HBillNo) { //try //{ // oWeb.WebService1 oweb = new DAL.oWeb.WebService1(); // // // oweb.Url = Pub_Class.ClsPub.HWEBSUrl_CLD; // // // if (oweb.DelBillProdIn(HBillNo, Pub_Class.ClsPub.HUrl_CLD, Pub_Class.ClsPub.HdbID_CLD, Pub_Class.ClsPub.HUserName_CLD, Pub_Class.ClsPub.HPsd_CLD, ref Pub_Class.ClsPub.sExeReturnInfo)) // { // return true; // } // else // { return false; // } //} //catch (Exception e) //{ // Pub_Class.ClsPub.sExeReturnInfo = ",调用WEBS失败! " + e.Message; // return false; //} } } }