public MBCode convertToMBcode(MBCodeDef mbcDef) { MBCode mbc = new MBCode(mbcDef.MBCode, mbcDef.Description, (short)mbcDef.Qty, mbcDef.editor, mbcDef.cdt, mbcDef.udt, mbcDef.Type); return mbc; }
public MBCodeDef convertToMbCodeDef(MBCode mbc) { MBCodeDef mbcDef = new MBCodeDef(); mbcDef.MBCode = mbc.MbCode; mbcDef.Description = mbc.Description; mbcDef.Type = mbc.Type; mbcDef.Qty = (int)mbc.MultQty; mbcDef.editor = mbc.Editor; mbcDef.cdt = mbc.Cdt; mbcDef.udt = mbc.Udt; return mbcDef; }
/// <summary> /// /// </summary> /// <param name="obj"></param> /// <param name="MBCode"></param> public void updateUniteMB(MBCodeDef obj, string MBCode) { IList<MBCode> mbcLst = MBrepository.GetLstByMB(MBCode); MBCode mbc = new MBCode(); MBCode mbcUpdate = new MBCode(); try { if (mbcLst != null && mbcLst.Count > 0) { mbc = mbcLst.First(); obj.cdt = mbc.Cdt; mbcUpdate = convertToMBcode(obj); } if (!MBCode.Equals(obj.MBCode)) { IList<MBCode> lstMBC = MBrepository.GetLstByMB(obj.MBCode); if (lstMBC != null && lstMBC.Count > 0) { //已经存在具有相同MBCode的MBCode记录 List<string> erpara = new List<string>(); FisException ex; ex = new FisException("DMT120", erpara); throw ex; } else { MBrepository.UpdateUniteMB(mbcUpdate, MBCode); } } else { MBrepository.UpdateUniteMB(mbcUpdate,MBCode); } } catch (FisException ex) { throw ex; } catch (Exception ex) { throw ex; } }