private void UpdateMOBom(MOBOM mobomObj) { try { string sql = string.Format("update tblmobom set MOBITEMQTY = MOBITEMQTY + {0} where 1=1 and MOCODE = '{1}' and ITEMCODE = '{2}' and MOBITEMCODE = '{3}'", mobomObj.MOBOMItemQty, mobomObj.MOCode, mobomObj.ItemCode, mobomObj.MOBOMItemCode); this.DataProvider.CustomExecute(new SQLCondition(sql)); } catch {} }
/// <summary> /// 判断导入的MO是否有效 /// </summary> /// <param name="obj">导入的MO</param> /// <returns>如果有效,返回true,否则,返回false;返回false时,这个MO将不会被导入</returns> private bool MOBOMDownloadCheck(object obj) { MOBOM mobom = (MOBOM)obj; if (mobom.MOCode.Trim().ToUpper() != MOCode) { ExceptionManager.Raise(this.GetType(), "$Error_MOCode_NotCompare", string.Format("[$MOCode='{0}']", MOCode)); } if (mobom.ItemCode.Trim().ToUpper() != ItemCode) { ExceptionManager.Raise(this.GetType(), "$Error_ItemCode_NotCompare", string.Format("[$ItemCode='{0}']", ItemCode)); } return(true); }
private MOBOM GetSelectMOBOM(UltraGridRow row) { if (facade == null) { facade = new FacadeFactory(base.DataProvider).CreateMOFacade(); } MOBOM mobom = this.facade.CreateNewMOBOM(); mobom.MOCode = row.Cells[1].Text.ToString(); mobom.ItemCode = row.Cells[2].Text.ToString(); mobom.MOBOMItemCode = row.Cells[3].Text.ToString(); mobom.MOBOMItemName = row.Cells[4].Text.ToString(); mobom.MOBOMItemQty = System.Decimal.Parse(row.Cells[5].Text.ToString()); mobom.MOBOMItemUOM = row.Cells[6].Text.ToString(); mobom.MOBOMException = row.Cells[7].Text.ToString(); return(mobom); }
//比对bom protected void cmdDownload_ServerClick(object sender, System.EventArgs e) { if (facade == null) { facade = new FacadeFactory(base.DataProvider).CreateMOFacade(); } ArrayList array = this.gridHelper.GetCheckedRows(); if (array.Count > 0) { MOBOM[] moboms1 = new MOBOM[array.Count]; if (moboms1.Length > 0) { for (int i = 0; i < array.Count; i++) { moboms1[i] = GetSelectMOBOM((UltraGridRow)array[i]); } moboms = this.facade.CompareMOBOMOPBOM(moboms1, ItemCode, MOCode, RouteCode); this.RequestData(); } } }
/// <summary> /// 映射SAP 工单bom到MES工单bom /// </summary> /// <returns></returns> private ArrayList MapSAPItem(object[] SAPItemObjs) { #region 参数判断 类型判断 if (SAPItemObjs == null) { return(new ArrayList()); } if (!(SAPItemObjs.Length > 0)) { return(new ArrayList()); } if (!(SAPItemObjs[0] is IImport)) { return(new ArrayList()); } ; if (SAPItemObjs[0].GetType() != typeof(SAPMOBom)) { ExceptionManager.Raise(this.GetType(), "$Error_Mapper_Parameter", string.Empty); //参数类型错误 } #endregion ArrayList mesObjs = new ArrayList(SAPItemObjs.Length); //映射返回的MES 工单 #region 射MOBOM的字段 int seq = 0; foreach (SAPMOBom _sapEntity in SAPItemObjs) { MOBOM _mesEntity = new MOBOM(); //WODETAIL 数据结构 //订单号 物料号码 发料工厂 工序 需求数量 领料数量 替代项 优先级 物料类型 计量单位 //AUFNR MATNR PWERK VORNR BDMNG ENMNG ALPGR ZPRI ZFLAG GMEIN _mesEntity.MOCode = this.DeletePrifix(_sapEntity.MOCode); //_sapEntity.MOCode; //工单号 需要去除前导0 _mesEntity.MOBOMItemCode = _sapEntity.MOBOMItemCode; _mesEntity.MOBOMItemName = _sapEntity.MOBOMItemName; _mesEntity.MOBOMItemQty = _sapEntity.UnitageQty; //单机用量 _mesEntity.MOBOMSourceItemCode = _sapEntity.PItem; //替代料 _mesEntity.MOBOMItemUOM = _sapEntity.MOBOMItemUOM; //计量单位 _mesEntity.OPCode = _sapEntity.OPCode; //工序Code _mesEntity.MOBOMItemStatus = "0"; // 1 - 使用中 0 - 正常 -1 - 已删除 _mesEntity.MaintainDate = FormatHelper.TODateInt(DateTime.Today); //最后维护日期 _mesEntity.MaintainTime = FormatHelper.TOTimeInt(DateTime.Today); //最后维护时间 _mesEntity.MaintainUser = "******"; //维护人员 默认为ADMIN _mesEntity.MOBOMItemVersion = "0"; //子阶料版本 默认为0 _mesEntity.MOBOMItemEffectiveDate = 20000101; //生效日期 _mesEntity.MOBOMItemEffectiveTime = 0; //生效时间 _mesEntity.MOBOMItemInvalidDate = 21001229; //失效日期 _mesEntity.MOBOMItemInvalidTime = 235959; //失效时间 _mesEntity.Sequence = ++MOBomSeq; //序号 ++seq; _mesEntity.MOBOMItemECN = ""; _mesEntity.MOBOMItemLocation = ""; _mesEntity.MOBOMItemDescription = ""; //子阶料描述 _mesEntity.MOBOMItemControlType = ""; //控制类型 _mesEntity.ItemCode = _sapEntity.ItemCode; //产品代码 //以下是没有映射的字段 mesObjs.Add(_mesEntity); } #endregion return(mesObjs); }