using System;
|
using System.Collections.Generic;
|
using System.Text;
|
using System.Data;
|
|
namespace WebAPI.DLL
|
{
|
public class ClsSc_ICMOBillWorkQtyStatus_Tmp : DBUtility.ClsXt_BaseBill
|
{
|
//Éú²ú²úÁ¿×´Ì¬ÁÙʱ±í
|
public Models.ClsSc_ICMOBillWorkQtyStatus_Tmp omodel = new Models.ClsSc_ICMOBillWorkQtyStatus_Tmp();
|
|
public ClsSc_ICMOBillWorkQtyStatus_Tmp()
|
{
|
base.MvarItemKeySub = "";
|
base.MvarItemKeySub2 = "";
|
base.MvarItemKeySub3 = "";
|
base.MvarItemKeySub4 = "";
|
base.MvarItemKey="Sc_ICMOBillWorkQtyStatus_Tmp";
|
base.MvarReportTitle="Éú²ú²úÁ¿×´Ì¬ÁÙʱ±í";
|
base.BillType = "3724";
|
}
|
|
#region ¹Ì¶¨´úÂë
|
|
~ClsSc_ICMOBillWorkQtyStatus_Tmp()
|
{
|
}
|
|
#endregion ×Ô¶¨Òå·½·¨
|
|
//Ð޸ĵ¥¾Ý
|
public override bool ModifyBill(Int64 lngBillKey, ref string sReturn)
|
{
|
try
|
{
|
//
|
oCn.BeginTran();
|
//¸üÐÂÖ÷±í
|
oCn.RunProc("UpDate Sc_ICMOBillWorkQtyStatus_Tmp set " +
|
"HSourceID=" + omodel.HSourceID.ToString() +
|
",HReportType=" + omodel.HReportType.ToString() +
|
",HPieceQty=" + omodel.HPieceQty.ToString() +
|
",HQty=" + omodel.HQty.ToString() +
|
",HBarCode='" + omodel.HBarCode + "'" +
|
",HAddr='" + omodel.HAddr + "'" +
|
",HSourceInterID=" + omodel.HSourceInterID.ToString() +
|
",HSourceEntryID=" + omodel.HSourceEntryID.ToString() +
|
",HSourceBillNo='" + omodel.HSourceBillNo + "'" +
|
",HSplitNO='" + omodel.HSplitNO + "'" +
|
",HSourceBillType='" + omodel.HSourceBillType + "'" +
|
",HRelationInterID=" + omodel.HRelationInterID.ToString() +
|
",HRelationEntryID=" + omodel.HRelationEntryID.ToString() +
|
",HRelationBillNo='" + omodel.HRelationBillNo + "'" +
|
",HReportEntryID=" + omodel.HReportEntryID.ToString() +
|
",HGroupID=" + omodel.HGroupID.ToString() +
|
",HWorkManID=" + omodel.HWorkManID.ToString() +
|
",HBadQty=" + omodel.HBadQty.ToString() +
|
",HWasterQty=" + omodel.HWasterQty.ToString() +
|
" where HInterID=" + lngBillKey.ToString());
|
//ɾ³ý¹ØÁª
|
DeleteRelation(ref sReturn, lngBillKey);
|
|
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();
|
DataSet ds;
|
|
//±£´æÇ°¿ØÖÆ=========================================
|
ds = oCn.RunProcReturn("exec h_p_Sc_ICMOBillWorkQtyStatus_BeforeSaveCtrl " + omodel.HInterID + "," + omodel.HSourceInterID + "," + omodel.HSourceEntryID + ",'" + omodel.HSourceBillNo + "'", "h_p_Sc_ICMOBillWorkQtyStatus_BeforeSaveCtrl");
|
|
if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) == "1")
|
{
|
sReturn = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
|
oCn.RollBack();
|
return false;
|
}
|
//=========================================================
|
|
//Ö÷±í
|
oCn.RunProc("Insert Into Sc_ICMOBillWorkQtyStatus_Tmp " +
|
"(HInterID,HBillType,HSourceID,HReportType,HPieceQty" +
|
",HMaterID,HGroupID,HWorkManID,HWorkReportDate,HDate" +
|
",HBillSubType,HBillNo,HICMOInterID,HICMOEntryID,HICMOBillNo" +
|
",HQty,HBadQty,HWasterQty,HBarCode,HAddr,HMaker,HMakeDate" +
|
",HSourceInterID,HSourceEntryID,HSourceBillNo,HSplitNO,HSourceBillType" +
|
",HRelationInterID,HRelationEntryID,HRelationBillNo,HReportEntryID,HBillStatus" +
|
") " +
|
" values(" + omodel.HInterID.ToString() + ",'" + BillType + "'," + omodel.HSourceID.ToString() + "," + omodel.HReportType.ToString() + "," + omodel.HPieceQty.ToString() +
|
"," + omodel.HMaterID.ToString() + ",'" + omodel.HGroupID + "','" + omodel.HWorkManID + "','" + omodel.HWorkReportDate + "','" + omodel.HDate + "'" +
|
",'" + omodel.HBillSubType.ToString() + "','" + omodel.HBillNo + "','" + omodel.HICMOInterID + "','" + omodel.HICMOEntryID + "','" + omodel.HICMOBillNo + "'" +
|
"," + omodel.HQty.ToString() + "," + omodel.HBadQty.ToString() + "," + omodel.HWasterQty.ToString() + ",'" + omodel.HBarCode + "','" + omodel.HAddr + "','" + omodel.HMaker+ "','" + omodel.HMakeDate + "'" +
|
"," + omodel.HSourceInterID.ToString() + "," + omodel.HSourceEntryID.ToString() + ",'" + omodel.HSourceBillNo + "','" + omodel.HSplitNO + "','" + omodel.HSourceBillType + "'" +
|
"," + omodel.HRelationInterID.ToString() + "," + omodel.HRelationEntryID.ToString() + ",'" + omodel.HRelationBillNo + "'," + omodel.HReportEntryID.ToString() + "," + omodel.HBillStatus.ToString() +
|
") ");
|
double sumqty = omodel.HQty + omodel.HBadQty + omodel.HWasterQty; //»ã±¨ÊýÁ¿+²»Á¼+±¨·Ï
|
//»ØÐ´Éú²ú״̬ÁÙʱ±íSc_ICMOBillStatus_Tmp²ð·Ö»ã±¨ÊýÁ¿ HSplitRelationQty
|
oCn.RunProc("update Sc_ICMOBillStatus_Tmp set HSplitRelationQty=HSplitRelationQty+" + sumqty + " where HICMOBillNo='" + omodel.HICMOBillNo + "' and HSourceID='" + omodel.HSourceID + "' and HICMOInterID='" + omodel.HICMOInterID + "' and HICMOEntryID='" + omodel.HICMOEntryID + "' and HInterID="+ omodel.HSourceInterID.ToString());
|
|
//ÔÙ´ÎÑéÖ¤ ±£´æÊÇ·ñ ºÏÀí
|
ds = oCn.RunProcReturn("exec h_p_JIT_ICMOBillWorkQtyStatus_SaveCtrl @HInterId=" + omodel.HInterID + "", "h_p_JIT_ICMOBillWorkQtyStatus_SaveCtrl");
|
if (ds == null || 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;
|
}
|
|
//±£´æºó¿ØÖÆ=========================================
|
ds = oCn.RunProcReturn("exec h_p_Sc_ICMOBillWorkQtyStatus_AfterSaveCtrl " + omodel.HInterID + "," + omodel.HSourceInterID + "," + omodel.HSourceEntryID + ",'" + omodel.HSourceBillNo + "'", "h_p_Sc_ICMOBillWorkQtyStatus_BeforeSaveCtrl");
|
|
if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) == "1")
|
{
|
sReturn = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
|
oCn.RollBack();
|
return false;
|
}
|
//=========================================================
|
|
sReturn = omodel.HInterID.ToString();
|
|
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_ICMOBillWorkQtyStatus_Tmp Where HInterID=" + lngBillKey.ToString(), "Sc_ICMOBillWorkQtyStatus_Tmp");
|
if(Ds.Tables[0].Rows.Count==0)
|
{
|
sReturn = "µ¥¾ÝδÕÒµ½£¡";
|
return false;
|
}
|
//¸³Öµ
|
omodel.HInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"]);
|
omodel.HBillType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillType"]);
|
omodel.HSourceID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSourceID"]);
|
omodel.HReportType = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HReportType"]);
|
omodel.HPieceQty = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPieceQty"]);
|
omodel.HQty = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HQty"]);
|
omodel.HBarCode = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBarCode"]);
|
omodel.HAddr = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HAddr"]);
|
omodel.HMaker = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMaker"]);
|
omodel.HMakeDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMakeDate"]);
|
omodel.HSourceInterID = DBUtility.ClsPub.isInt(Ds.Tables[0].Rows[0]["HSourceInterID"]);
|
omodel.HSourceEntryID = DBUtility.ClsPub.isInt(Ds.Tables[0].Rows[0]["HSourceEntryID"]);
|
omodel.HSourceBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HSourceBillNo"]);
|
omodel.HSplitNO = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HSplitNO"]);
|
omodel.HSourceBillType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HSourceBillType"]);
|
omodel.HRelationInterID = DBUtility.ClsPub.isInt(Ds.Tables[0].Rows[0]["HRelationInterID"]);
|
omodel.HRelationEntryID = DBUtility.ClsPub.isInt(Ds.Tables[0].Rows[0]["HRelationEntryID"]);
|
omodel.HRelationBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRelationBillNo"]);
|
omodel.HReportEntryID = DBUtility.ClsPub.isInt(Ds.Tables[0].Rows[0]["HReportEntryID"]);
|
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();
|
|
sReturn = "ÏÔʾµ¥¾Ý³É¹¦£¡";
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
throw (e);
|
}
|
}
|
|
|
//ÉóºË
|
public bool CheckBill(int HSourceID, int HSourceInterID, int HSourceEntryID, string HSourceBillNo, int HICMOInterID, int HICMOEntryID, Int64 lngBillKey, ref string sReturn)
|
{
|
|
try
|
{
|
string HChecker = DBUtility.ClsPub.CurUserName;
|
string HCheckDate = DBUtility.ClsPub.GetServerDate(-1);
|
oCn.BeginTran();
|
oCn.RunProc(" Update " + MvarItemKey + " set HBillStatus='2',HChecker='" + HChecker + "',HCheckDate='" + HCheckDate + "' Where HInterID=" + lngBillKey.ToString());
|
//¸ù¾ÝÔ´µ¥Ö÷ÄÚÂë ÉèÖà Éú²ú״̬±í Í깤״̬(ÉèÖñ¾µ¥¶ÔÓ¦µÃÔ´µ¥ ΪÍ깤״̬)
|
//oCn.RunProc("exec h_p_JIT_MESICMOReport_Status " + HSourceID.ToString() + "," + HSourceInterID.ToString() + "," + HSourceEntryID.ToString() + ",'" + HSourceBillNo.ToString() + "','" + HPlanQty + "'");
|
//¸üÐÂÉú²ú״̬ÁÙʱ״̬±íÊýÁ¿
|
//oCn.RunProc("exec h_p_Sc_UpDateRelation_ICMOToICMOReport_Qty " + HICMOInterID.ToString() + "," + HICMOEntryID.ToString() + "");
|
//¸ù¾ÝÔ´µ¥Ö÷ÄÚÂë ÉèÖà Éú²ú״̬±í Í깤״̬(ÉèÖñ¾µ¥¶ÔÓ¦µÃÔ´µ¥ ΪÍ깤״̬) ¸üÐÂÉú²ú״̬ÁÙʱ״̬±íÊýÁ¿
|
oCn.RunProc("exec h_p_JIT_ICMOBillWorkQtyStatus_AddRelation " + HSourceID.ToString() + "," + HSourceInterID.ToString() + "," + HSourceEntryID.ToString() + ",'" + HSourceBillNo.ToString() + "'," + HICMOInterID.ToString() + "," + HICMOEntryID.ToString() + "");
|
sReturn = "ÉóºËµ¥¾Ý³É¹¦£¡";
|
oCn.Commit();
|
//Éú³Éµ÷²¦µ¥
|
//µÃµ½µ÷²¦µ¥ mainid µ¥¾ÝºÅ
|
//long NewInterID = DBUtility.ClsPub.CreateBillID("1207", ref DBUtility.ClsPub.sExeReturnInfo);
|
//string NewBillNo = DBUtility.ClsPub.CreateBillCode("1207", ref DBUtility.ClsPub.sExeReturnInfo, true);//µÃµ½Ðµ¥ºÅ
|
//oCn.RunProc("exec h_p_Kf_MoveStockBill_Add " + lngBillKey.ToString() + "," + NewInterID.ToString() + ",'" + NewBillNo + "','" + HChecker + "'");
|
//
|
sReturn = "";
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
throw (e);
|
}
|
}
|
|
//·´ÉóºË
|
public bool AbandonCheck(int HSourceID, int HSourceInterID, int HSourceEntryID, string HSourceBillNo, int HICMOInterID, int HICMOEntryID, Int64 lngBillKey, ref string sReturn)
|
{
|
|
try
|
{
|
string HChecker = DBUtility.ClsPub.CurUserName;
|
string HCheckDate = DBUtility.ClsPub.GetServerDate(-1);
|
oCn.BeginTran();
|
//»¹Ôµ¥¾Ý״̬ΪδÉóºË״̬
|
oCn.RunProc(" Update " + MvarItemKey + " set HBillStatus='1',HChecker='',HCheckDate='' Where HInterID=" + lngBillKey.ToString());
|
//¿Û¼õÉú²ú״̬±í±¾¹¤µ¥µÄ²ð·Ö»ã±¨Êý¡¢µ±ÈÕÍ깤ÊýÁ¿¡¢¸üÐÂÉú²ú״̬±í µ¥¾Ý״̬(»ã±¨ÊýÁ¿¿Û¼õСÓÚ)
|
oCn.RunProc("exec h_p_JIT_ICMOBillWorkQtyStatus_DelRelation " + HSourceID.ToString() + "," + HSourceInterID.ToString() + "," + HSourceEntryID.ToString() + ",'" + HSourceBillNo.ToString() + "'," + HICMOInterID.ToString() + "," + HICMOEntryID.ToString() + ","+ lngBillKey + "");
|
sReturn = "ÉóºËµ¥¾Ý³É¹¦£¡";
|
oCn.Commit();
|
//Éú³Éµ÷²¦µ¥
|
//µÃµ½µ÷²¦µ¥ mainid µ¥¾ÝºÅ
|
//long NewInterID = DBUtility.ClsPub.CreateBillID("1207", ref DBUtility.ClsPub.sExeReturnInfo);
|
//string NewBillNo = DBUtility.ClsPub.CreateBillCode("1207", ref DBUtility.ClsPub.sExeReturnInfo, true);//µÃµ½Ðµ¥ºÅ
|
//oCn.RunProc("exec h_p_Kf_MoveStockBill_Add " + lngBillKey.ToString() + "," + NewInterID.ToString() + ",'" + NewBillNo + "','" + HChecker + "'");
|
//
|
sReturn = "";
|
return true;
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
throw (e);
|
}
|
}
|
|
//ÅжÏÊÇ·ñÍ깤
|
public bool IsEnded(long HInterID, ref string sReturn)
|
{
|
try
|
{
|
DataSet DS;
|
DS = oCn.RunProcReturn("exec h_p_Sc_ICMOReportBill_WMSQty " + HInterID.ToString(), "Sc_ICMOReportBillSub_WMS");
|
if (DS.Tables[0].Rows.Count == 0)
|
{
|
return false;
|
}
|
if (DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0]["HBool"]) != "")
|
{
|
sReturn = "ÒÑÍ깤£¡";
|
return true;
|
}
|
else
|
{
|
sReturn = "δÍ깤£¡";
|
return false;
|
}
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
throw (e);
|
}
|
}
|
|
|
|
|
}
|
|
}
|