using System;
|
using System.Collections.Generic;
|
using System.Text;
|
using System.Data;
|
|
namespace DAL
|
{
|
public class ClsSc_StationEntrustOutBill:DBUtility.ClsXt_BaseBill
|
{
|
public Model.ClsSc_StationEntrustOutBillMain omodel = new Model.ClsSc_StationEntrustOutBillMain();
|
public List<Model.ClsSc_StationEntrustOutBillSub> DetailColl = new List<Model.ClsSc_StationEntrustOutBillSub>();
|
public List<Model.ClsSc_StationEntrustOutBillSub_Item> DetailColl1 = new List<Model.ClsSc_StationEntrustOutBillSub_Item>();
|
public ClsSc_StationEntrustOutBill()
|
{
|
base.MvarItemKeySub = "Sc_StationOutBillSub";
|
base.MvarItemKeySub2 = "";
|
base.MvarItemKeySub3 = "";
|
base.MvarItemKeySub4 = "";
|
base.MvarItemKey="Sc_StationOutBillMain";
|
base.MvarReportTitle="委外工序接收";
|
base.BillType="3793";
|
base.HBillSubType = "3793";
|
|
}
|
|
#region 固定代码
|
|
~ClsSc_StationEntrustOutBill()
|
{
|
DetailColl = null;
|
}
|
|
#endregion 自定义方法
|
|
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;
|
//}
|
}
|
|
//修改单据
|
public override bool ModifyBill(Int64 lngBillKey, ref string sReturn)
|
{
|
try
|
{
|
//
|
oCn.BeginTran();
|
|
//删除关联
|
// oCn.RunProc("exec h_p_StationInBillRelation_Del " + lngBillKey);
|
|
oCn.RunProc("exec h_p_Mes_ProcessExchangeRelationQty_Out " + lngBillKey.ToString() + ",-1");
|
oCn.RunProc("exec h_p_WW_EntrustWorkOrderRelationQty_Out " + lngBillKey.ToString() + ",-1");
|
//更新主表
|
oCn.RunProc("UpDate Sc_StationOutBillMain 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='" + DBUtility.ClsPub.CurUserName + "'" +
|
",HUpDateDate=getdate()" +
|
//",HCloseMan='" + omodel.HCloseMan + "'" +
|
//",HCloseDate='" + omodel.HCloseDate + "'" +
|
//",HCloseType="+omodel.HCloseType.ToString()+
|
//",HDeleteMan='" + omodel.HDeleteMan + "'" +
|
//",HDeleteDate='" + omodel.HDeleteDate + "'" +
|
//",HPrintQty="+omodel.HPrintQty.ToString()+
|
",HInnerBillNo='" + omodel.HInnerBillNo + "'" +
|
//",HWWWorkOrderBillNo='" + omodel.HWWWorkOrderBillNo.ToString() + "'" +
|
//",HWWWorkOrderInterID=" + omodel.HWWWorkOrderInterID.ToString() + "" +
|
//",HWWWorkOrderEntryID=" + omodel.HWWWorkOrderEntryID.ToString() + "" +
|
//========================================
|
",HSupID=" + omodel.HSupID.ToString() +
|
",HQty=" + omodel.HQty.ToString() +
|
",HPieceQty=" + omodel.HPieceQty.ToString() +
|
",HPrice=" + omodel.HPrice.ToString() +
|
",HMoney=" + omodel.HMoney.ToString() +
|
",HProcNo=" + omodel.HProcNo.ToString() +
|
",HPrice_BHS=" + omodel.HPrice_BHS.ToString() +
|
",HMoney_BHS=" + omodel.HMoney_BHS.ToString() +
|
",HTaxRate=" + omodel.HTaxRate.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 + "'" +
|
|
",HOrderProcNO='" + omodel.HOrderProcNO + "'" +
|
",HMaterID=" + omodel.HMaterID.ToString() +
|
",HProcID=" + omodel.HProcID.ToString() +
|
",HBadPNL=" + omodel.HBadPNL.ToString() +
|
",HWasterQty=" + omodel.HWasterQty.ToString() +
|
",HBadCount=" + omodel.HBadCount.ToString() +
|
//",HICMOQty=" + omodel.HICMOQty.ToString() +
|
//",HPlanQty=" + omodel.HPlanQty.ToString() +
|
//",HStationOutTime='" + omodel.HStationOutTime + "'" +
|
//",HSourceID=" + omodel.HSourceID.ToString() +
|
//",HGroupID=" + omodel.HGroupID.ToString() +
|
//",HDeptID=" + omodel.HDeptID.ToString() +
|
//",HEmpID=" + omodel.HEmpID.ToString() +
|
//",HReportType='" + omodel.HReportType + "'" +
|
//",HBarCode='" + omodel.HBarCode + "'" +
|
//",HAddr='" + omodel.HAddr + "'" +
|
//",HBarCodeMaker='" + omodel.HBarCodeMaker + "'" +
|
//",HBarCodeMakeDate='" + omodel.HBarCodeMakeDate + "'" +
|
" 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_StationEntrustOutBillSub 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_StationEntrustOutBillSub_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_StationInBillRelation_Add " + omodel.HMainSourceInterID, "h_p_StationInBillRelation_Add");
|
//if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0][0]) != "OK")
|
//{
|
// sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0][0]);
|
// oCn.RollBack();
|
// return false;
|
//}
|
|
//根据进站单内码 控制进站数量(进站按计划数量控制(暂时不要))(进站数量 按上道工序 合计出站数量控制、且不能小于 本道工序 合计出站数量))
|
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_WW_EntrustWorkOrderRelationQty_Out " + omodel.HInterID.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 )
|
//{
|
// //
|
//}
|
//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 + "',0," + " " + 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\":\"023\"}, \"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\":\"023\"}, \"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("3793", ref DBUtility.ClsPub.sExeReturnInfo);
|
//若MAINDI重复则重新获取
|
oCn.BeginTran();
|
//主表
|
oCn.RunProc("Insert Into Sc_StationOutBillMain " +
|
"(HBillType,HBillSubType,HInterID,HBillNo,HBillStatus,HDate,HMaker,HMakeDate" +
|
",HYear,HPeriod,HRemark,HInnerBillNo,HSourceName,HPieceQty,HWasterQty,HPlanPieceQty,HBadPNL" +
|
",HICMOInterID,HICMOBillNo,HProcPlanInterID,HProcPlanEntryID,HProcPlanBillNo,HProcExchInterID,HProcExchEntryID" +
|
",HProcExchBillNo,HMaterID,HProcID,HICMOQty,HPlanQty,HStationOutTime,HSourceID" +
|
",HGroupID,HDeptID,HEmpID,HBarCode,HAddr,HBarCodeMaker,HBarCodeMakeDate" +
|
",HSupID,HTaxRate,HQty,HPrice,HMoney,HPrice_BHS,HMoney_BHS,HBadCount" +
|
",HMainSourceInterID,HMainSourceBillNo,HMainSourceBillType,HProcNo,HOrderProcNO,HLastSubProc,HWWWorkOrderBillNo,HWWWorkOrderInterID,HWWWorkOrderEntryID" +
|
") " +
|
" values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "'," + omodel.HBillStatus.ToString() + ",getdate(),'" + DBUtility.ClsPub.CurUserName + "',getdate()" +
|
"," + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + omodel.HInnerBillNo + "','" + 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() + ",getdate()," + omodel.HSourceID.ToString() +
|
"," + omodel.HGroupID.ToString() + "," + omodel.HDeptID.ToString() + "," + omodel.HEmpID.ToString() + ",'" + omodel.HBarCode + "','" + omodel.HAddr + "','" + omodel.HBarCodeMaker + "',getdate()" +
|
"," + omodel.HSupID.ToString() + "," + omodel.HTaxRate.ToString() + "," + omodel.HQty.ToString() + "," + omodel.HPrice.ToString() + "," + omodel.HMoney.ToString() + "," + omodel.HPrice_BHS.ToString() + "," + omodel.HMoney_BHS.ToString() + "," + omodel.HBadCount.ToString() +
|
"," + omodel.HMainSourceInterID.ToString() + ",'" + omodel.HMainSourceBillNo + "','" + omodel.HMainSourceBillType + "'," + omodel.HProcNo.ToString() + ",'" + omodel.HOrderProcNO + "'," + Convert.ToString(omodel.HLastSubProc ? 1 : 0) + ",'" + omodel.HWWWorkOrderBillNo.ToString() + "'" + "," + omodel.HWWWorkOrderInterID.ToString() + "" + "," + omodel.HWWWorkOrderEntryID.ToString() + "" +
|
") ");
|
//插入子表
|
foreach (Model.ClsSc_StationEntrustOutBillSub 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='" + DBUtility.ClsPub.GetServerDate(-1) + "' where HInterID=" + omodel.HProcExchInterID.ToString() + " and HEntryID=" + omodel.HProcExchEntryID.ToString());
|
//foreach (Model.ClsSc_StationEntrustOutBillSub_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_StationInBillRelation_Add " + omodel.HMainSourceInterID, "h_p_StationInBillRelation_Add");
|
//if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0][0]) != "OK")
|
//{
|
// sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0][0]);
|
// oCn.RollBack();
|
// return false;
|
//}
|
|
//增加 供应商控制
|
//根据进站单内码 控制进站数量(进站按计划数量控制(暂时不要))(进站数量 按上道工序 合计出站数量控制、且不能小于 本道工序 合计出站数量))
|
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_WW_EntrustWorkOrderRelationQty_Out " + omodel.HInterID.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 )
|
//{
|
// //
|
//}
|
//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 + "',0," + " " + 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\":\"023\"}, \"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\":\"023\"}, \"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 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.HInnerBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HInnerBillNo"]);
|
omodel.HProcNo = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HProcNo"]);
|
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.HTaxRate = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HTaxRate"]);
|
omodel.HQty = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HQty"]);
|
omodel.HPieceQty = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HPieceQty"]);
|
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.HPrice_BHS = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HPrice_BHS"]);
|
omodel.HMoney_BHS = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HMoney_BHS"]);
|
//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.HICMOQty = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HICMOQty"]);
|
omodel.HPlanQty = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HPlanQty"]);
|
omodel.HPlanPieceQty = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HPlanPieceQty"]);
|
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.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.HOrderProcNO = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HOrderProcNO"]);
|
omodel.HWWWorkOrderBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HWWWorkOrderBillNo"]);
|
omodel.HWWWorkOrderInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HWWWorkOrderInterID"]);
|
omodel.HWWWorkOrderEntryID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HWWWorkOrderEntryID"]);
|
//
|
|
//循环
|
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_StationEntrustOutBillSub oSub = new Model.ClsSc_StationEntrustOutBillSub();
|
// 固定赋值===============================================
|
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);
|
}
|
//DataSet DsSub2;
|
//DsSub2 = oCn.RunProcReturn("Select * from Sc_StationOutBillSub_Item Where HInterID=" + lngBillKey.ToString(), "Sc_StationOutBillSub_Item");
|
//DetailColl1.Clear();//清空
|
//for (int i = 0; i < DsSub2.Tables[0].Rows.Count; i++)
|
//{
|
// Model.ClsSc_StationEntrustOutBillSub_Item oSub2 = new Model.ClsSc_StationEntrustOutBillSub_Item();
|
// // 固定赋值===============================================
|
// oSub2.HInterID = DBUtility.ClsPub.isLong(DsSub2.Tables[0].Rows[i]["HInterID"]);
|
// oSub2.HEntryID = DBUtility.ClsPub.isLong(DsSub2.Tables[0].Rows[i]["HEntryID"]);
|
|
// oSub2.HProcNo = DBUtility.ClsPub.isLong(DsSub2.Tables[0].Rows[i]["HProcNo"]);
|
// oSub2.HTechParamID = DBUtility.ClsPub.isLong(DsSub2.Tables[0].Rows[i]["HTechParamID"]);
|
// oSub2.HTechParamUnitID = DBUtility.ClsPub.isLong(DsSub2.Tables[0].Rows[i]["HTechParamUnitID"]);
|
// oSub2.HValue = DBUtility.ClsPub.isStrNull(DsSub2.Tables[0].Rows[i]["HValue"]);
|
// oSub2.HStd = DBUtility.ClsPub.isStrNull(DsSub2.Tables[0].Rows[i]["HStd"]);
|
// oSub2.HType = DBUtility.ClsPub.isStrNull(DsSub2.Tables[0].Rows[i]["HType"]);
|
// //===================================================
|
|
// DetailColl1.Add(oSub2);
|
//}
|
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 )
|
{
|
//
|
}
|
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\":\"023\"}, \"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\":\"023\"}, \"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 )
|
{
|
//
|
}
|
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 CheckIsKP(long HInterID , ref string sReturn)
|
{
|
DataSet Ds;
|
Ds = oCn.RunProcReturn("exec h_p_Sc_StationCheckIsKP " + HInterID , "h_p_Sc_StationCheckIsKP");
|
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 CheckQty(long HInterID, double HQty, double HPieceQty, ref string sReturn)
|
{
|
DataSet Ds;
|
Ds = oCn.RunProcReturn("exec h_p_MES_StationEntrustInBill_NoLot_CheckQty " + HInterID + "," + HQty + "," + HPieceQty, "h_p_MES_StationEntrustInBill_NoLot_CheckQty");
|
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 DeleteBill(long HInterID, long HProcExchInterID, long HProcExchEntryID, string HBillNo, string procName, string user, ref string sReturn)
|
{
|
try
|
{
|
oCn.BeginTran();
|
//删除关联
|
|
|
oCn.RunProc("exec h_p_Mes_ProcessExchangeRelationQty_Out " + HInterID.ToString() + ",-1");
|
oCn.RunProc("exec h_p_WW_EntrustWorkOrderRelationQty_Out " + HInterID.ToString() + ",-1");
|
//
|
// oCn.RunProc("exec h_p_StationInBillRelation_Del " + HInterID);
|
//删除单据
|
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);
|
|
//删除后控制==================================================================================
|
string sql2 = "exec " + procName + " " + HInterID + ",'" + HBillNo + "','" + user + "'";
|
DataSet ds = oCn.RunProcReturn(sql2, procName);
|
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
|
{
|
|
sReturn = "删除失败!原因:删除后判断失败,请与网络管理人员联系";
|
oCn.RollBack();
|
return false;
|
}
|
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
|
{
|
sReturn = "删除失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString();
|
oCn.RollBack();
|
return false;
|
}
|
//==============================================================================================
|
|
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;
|
}
|
}
|
}
|