public void Add(LogicObject.SN SN, string BU, string user, OleExec DB) { if (SN.SkuNo != DATA.SKUNO) { throw new Exception($@"SN.SKUNO ={SN.SkuNo} PACK.SKUNO={DATA.SKUNO}"); } T_R_SN_PACKING TRSP = new T_R_SN_PACKING(DB, DB_TYPE_ENUM.Oracle); if (DATA.MAX_QTY <= GetCount(DB)) { throw new Exception($@"{DATA.PACK_NO} is Full"); } Row_R_SN_PACKING RRSP = TRSP.GetDataBySNID(SN.ID, DB); if (RRSP != null) { throw new Exception($@"{SN.SerialNo} is Packed"); } RRSP = (Row_R_SN_PACKING)TRSP.NewRow(); RRSP.ID = TRSP.GetNewID(BU, DB); RRSP.PACK_ID = DATA.ID; RRSP.SN_ID = SN.ID; RRSP.EDIT_EMP = user; RRSP.EDIT_TIME = DateTime.Now; DB.ExecSQL(RRSP.GetInsertString(DB_TYPE_ENUM.Oracle)); RRSP.AcceptChange(); DATA.QTY = GetCount(DB); DATA.EDIT_TIME = DateTime.Now; DATA.EDIT_EMP = user; DB.ExecSQL(DATA.GetUpdateString(DB_TYPE_ENUM.Oracle)); DATA.AcceptChange(); }
public void Add(CartionBase Cartion, string BU, string user, OleExec DB) { if (Cartion.DATA.SKUNO != DATA.SKUNO) { throw new Exception("Cartion.DATA.SKUNO != Pallet.SKUNO"); } if (GetCount(DB) >= DATA.MAX_QTY) { throw new Exception($@"{DATA.PACK_NO} is Full"); } if (Cartion.DATA.PARENT_PACK_ID != null && Cartion.DATA.PARENT_PACK_ID != "") { throw new Exception($@"{Cartion.DATA.PACK_NO} is packed"); } Cartion.DATA.PARENT_PACK_ID = DATA.ID; Cartion.DATA.EDIT_EMP = user; Cartion.DATA.EDIT_TIME = DateTime.Now; DB.ExecSQL(Cartion.DATA.GetUpdateString(DB_TYPE_ENUM.Oracle)); Cartion.DATA.AcceptChange(); DATA.EDIT_EMP = user; DATA.EDIT_TIME = DateTime.Now; DATA.QTY = GetCount(DB); DB.ExecSQL(DATA.GetUpdateString(DB_TYPE_ENUM.Oracle)); DATA.AcceptChange(); }
public static Row_R_PACKING GetNewPacking(C_PACKING config, string line, string Station, string IP, string BU, string User, OleExec DB) { T_R_PACKING TRP = new T_R_PACKING(DB, DB_TYPE_ENUM.Oracle); Row_R_PACKING RRP = (Row_R_PACKING)TRP.NewRow(); RRP.PACK_NO = SNMaker.SNmaker.GetNextSN(config.SN_RULE, DB); RRP.PACK_TYPE = config.PACK_TYPE; RRP.PARENT_PACK_ID = ""; RRP.SKUNO = config.SKUNO; RRP.MAX_QTY = config.MAX_QTY; RRP.QTY = 0; RRP.CLOSED_FLAG = "0"; RRP.LINE = line; RRP.STATION = Station; RRP.ID = TRP.GetNewID(BU, DB); RRP.IP = IP; DB.ExecSQL(RRP.GetInsertString(DB_TYPE_ENUM.Oracle)); RRP.AcceptChange(); return(RRP); }