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(); }