// 批量领料(支持按作业领料)@2014-4-16 /// <summary> /// 修改于20150325 /// </summary> /// <param name="userName"></param> /// <param name="releaseHeaderIds"></param> /// <returns></returns> public bool BatchGetMaterialTask(string userName, string releaseHeaderIds) { bool result = false; List<AscmWipRequirementOperations> list = new List<AscmWipRequirementOperations>(); List<WmsAndLogistics> InterfaceList = new List<WmsAndLogistics>(); try { string task_ids = string.Empty; string[] taskArray = null; if (!string.IsNullOrEmpty(releaseHeaderIds)) { taskArray = releaseHeaderIds.Split(','); foreach (string item in taskArray) { if (!string.IsNullOrEmpty(item)) { if (item.IndexOf("[") == -1) { if (item.IndexOf(":") > -1) { if (list.Count > 0) { foreach(AscmWipRequirementOperations ascmWipRequirementOperations in AscmWipRequirementOperationsService.GetInstance().GetList("", "", "", "", "", item.Split(':')[0], "", item.Split(':')[1])) { if(list.Select(p=>p.id).Contains(ascmWipRequirementOperations.id)) { continue; } else { list.Add(ascmWipRequirementOperations); } } } } else { if (list.Count > 0) { foreach (AscmWipRequirementOperations ascmWipRequirementOperations in AscmWipRequirementOperationsService.GetInstance().GetList("", "", "", "", "", item, "", "")) { if (list.Select(p => p.id).Contains(ascmWipRequirementOperations.id)) { continue; } else { list.Add(ascmWipRequirementOperations); } } } } // task_ids += item; //task_ids += item.Substring(0, item.IndexOf("[")); } else { if (!list.Select(p => p.id).Contains(int.Parse(item.Substring(item.IndexOf("[") + 1, item.IndexOf("]") - (item.IndexOf("[") + 1))))) { if (!string.IsNullOrEmpty(task_ids)) task_ids += ","; task_ids += item.Substring(item.IndexOf("[") + 1, item.IndexOf("]") - (item.IndexOf("[") + 1)); } task_ids += item; } } } } //判断任务是否在执行中 // bool isExecutable = false; if (!string.IsNullOrEmpty(task_ids)) { IList<AscmWipRequirementOperations> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find<AscmWipRequirementOperations>("from AscmWipRequirementOperations where id in (" + task_ids + ")"); if (ilist != null && ilist.Count > 0) { list.AddRange(ilist); } //string sql = "select count(*) from AscmGetMaterialTask"; //string where = "", whereQueryWord = ""; //whereQueryWord = "status != '" + AscmGetMaterialTask.StatusDefine.execute + "'"; //where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord); //whereQueryWord = AscmCommonHelperService.GetInstance().IsJudgeListCount(task_ids, "id"); //where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord); //if (!string.IsNullOrEmpty(where)) // sql += " where " + where; //object obj_taskCount = YnDaoHelper.GetInstance().nHibernateHelper.GetObject(sql); //if (obj_taskCount == null) // throw new Exception("查询任务失败(Find AscmGetMaterialTask)"); //if (int.Parse(obj_taskCount.ToString()) == 0) // isExecutable = true; } ////任务未在执行中 //if (!isExecutable) // throw new Exception("选择的所有任务未在执行中!"); ////领料操作 bool isCompletion = false; //if (isExecutable) //{ // foreach (string item in taskArray) // { // if (!string.IsNullOrEmpty(item)) // { // string sql = "from AscmWipRequirementOperations a, AscmGetMaterialTask b where "; // string where = "", whereQueryWord = ""; // if (item.IndexOf("[") > -1) // { // int taskId = int.Parse(item.Substring(0, item.IndexOf("["))); // int wipEntityId = int.Parse(item.Substring(item.IndexOf("[") + 1, item.IndexOf("]") - (item.IndexOf("[") + 1))); // whereQueryWord = "taskId = " + taskId; // where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord); // whereQueryWord = "wipEntityId = " + wipEntityId; // where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord); // if (!string.IsNullOrEmpty(where)) // sql += " where " + where; // CommonGetMaterialMethod(sql, userName, list, InterfaceList); // } // else // { // int taskId = int.Parse(item); // whereQueryWord = "taskId = " + taskId; // where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord); // if (!string.IsNullOrEmpty(where)) // sql += " where " + where; // CommonGetMaterialMethod(sql, userName, list, InterfaceList); // } // } // } foreach (AscmWipRequirementOperations ascmWipRequirementOperations in list) { if (ascmWipRequirementOperations.wmsPreparationQuantity > 0) { WmsAndLogistics wmsAndLogistics = new WmsAndLogistics(); wmsAndLogistics.wipEntityId = ascmWipRequirementOperations.wipEntityId; wmsAndLogistics.materialId = ascmWipRequirementOperations.inventoryItemId; wmsAndLogistics.quantity = ascmWipRequirementOperations.wmsPreparationQuantity; if (!string.IsNullOrEmpty(ascmWipRequirementOperations.wmsPreparationString)) { if (ascmWipRequirementOperations.wmsPreparationString.IndexOf(',') > -1) { string[] strarr = ascmWipRequirementOperations.wmsPreparationString.Split(','); foreach (string str in strarr) { if (!string.IsNullOrEmpty(str)) { string temp = str.Substring(0, str.IndexOf('[')); if (!string.IsNullOrEmpty(wmsAndLogistics.preparationString)) wmsAndLogistics.preparationString += ","; wmsAndLogistics.preparationString += temp; } } } else { string temp = ascmWipRequirementOperations.wmsPreparationString.Substring(0, ascmWipRequirementOperations.wmsPreparationString.IndexOf('[')); wmsAndLogistics.preparationString += temp; } } wmsAndLogistics.workerId = userName; InterfaceList.Add(wmsAndLogistics); ascmWipRequirementOperations.getMaterialQuantity += ascmWipRequirementOperations.wmsPreparationQuantity; if (!string.IsNullOrEmpty(ascmWipRequirementOperations.getMaterialString)) ascmWipRequirementOperations.getMaterialString += ","; ascmWipRequirementOperations.getMaterialString += ascmWipRequirementOperations.wmsPreparationQuantity.ToString(); ascmWipRequirementOperations.wmsPreparationQuantity = 0; ascmWipRequirementOperations.modifyTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm"); ascmWipRequirementOperations.modifyUser = userName; // list.Add(ascmWipRequirementOperations); } } int d= list.Select(p => p.id).Distinct().Count(); if (list.Count > 0 && InterfaceList.Count > 0) { WmsAndLogisticsService.GetInstance().DoMaterialRequisition(InterfaceList); AscmWipRequirementOperationsService.GetInstance().Update(list); isCompletion = true; } //调用接口未成功时 if (!isCompletion) throw new Exception("选择的领料任务未备料!"); //记录时间节点及自动完成任务 if (isCompletion) { string sql = "from AscmGetMaterialTask id in (select distinct taskId from AscmWipRequirementOperations where id in ("+task_ids+"))"; // string where = "", whereQueryWord = ""; //whereQueryWord = AscmCommonHelperService.GetInstance().IsJudgeListCount(task_ids, "id"); //where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord); //if (!string.IsNullOrEmpty(where)) // sql += " where " + where; IList<AscmGetMaterialTask> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find<AscmGetMaterialTask>(sql); if (ilist != null && ilist.Count > 0) { List<AscmGetMaterialTask> listTask = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList<AscmGetMaterialTask>(ilist); AscmGetMaterialTaskService.GetInstance().SumQuantity(listTask); foreach (AscmGetMaterialTask ascmGetMaterialTask in listTask) { if (!string.IsNullOrEmpty(ascmGetMaterialTask.errorTime)) ascmGetMaterialTask.errorTime += ","; ascmGetMaterialTask.errorTime += DateTime.Now.ToString("yyyy-MM-dd HH:mm"); ascmGetMaterialTask.modifyTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm"); ascmGetMaterialTask.modifyUser = userName; if (ascmGetMaterialTask.totalQuantityGetMaterialDiff == 0) { ascmGetMaterialTask.status = AscmGetMaterialTask.StatusDefine.finish; if (string.IsNullOrEmpty(ascmGetMaterialTask.endTime)) { ascmGetMaterialTask.endTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm"); } } else { if (string.IsNullOrEmpty(ascmGetMaterialTask.starTime)) { ascmGetMaterialTask.starTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm"); } } } AscmGetMaterialTaskService.GetInstance().Update(listTask); } result = true; } } catch (Exception ex) { YnBaseClass2.Helper.LogHelper.GetLog().Error(ex.Message, ex); throw ex; } return result; }
// 公用领料方法@2014-4-16 public void CommonGetMaterialMethod(string sql, string userName, List<AscmWipRequirementOperations> list, List<WmsAndLogistics> InterfaceList) { if (!string.IsNullOrEmpty(sql)) { IList<AscmWipRequirementOperations> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find<AscmWipRequirementOperations>(sql); if (ilist != null && ilist.Count > 0) { List<AscmWipRequirementOperations> newlist = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList<AscmWipRequirementOperations>(ilist); foreach (AscmWipRequirementOperations ascmWipRequirementOperations in newlist) { if (ascmWipRequirementOperations.wmsPreparationQuantity > 0) { WmsAndLogistics wmsAndLogistics = new WmsAndLogistics(); wmsAndLogistics.wipEntityId = ascmWipRequirementOperations.wipEntityId; wmsAndLogistics.materialId = ascmWipRequirementOperations.inventoryItemId; wmsAndLogistics.quantity = ascmWipRequirementOperations.wmsPreparationQuantity; if (!string.IsNullOrEmpty(ascmWipRequirementOperations.wmsPreparationString)) { if (ascmWipRequirementOperations.wmsPreparationString.IndexOf(',') > -1) { string[] strarr = ascmWipRequirementOperations.wmsPreparationString.Split(','); foreach (string str in strarr) { if (!string.IsNullOrEmpty(str)) { string temp = str.Substring(0, str.IndexOf('[')); if (!string.IsNullOrEmpty(wmsAndLogistics.preparationString)) wmsAndLogistics.preparationString += ","; wmsAndLogistics.preparationString += temp; } } } else { string temp = ascmWipRequirementOperations.wmsPreparationString.Substring(0, ascmWipRequirementOperations.wmsPreparationString.IndexOf('[')); wmsAndLogistics.preparationString += temp; } } wmsAndLogistics.workerId = userName; InterfaceList.Add(wmsAndLogistics); ascmWipRequirementOperations.getMaterialQuantity += ascmWipRequirementOperations.wmsPreparationQuantity; if (!string.IsNullOrEmpty(ascmWipRequirementOperations.getMaterialString)) ascmWipRequirementOperations.getMaterialString += ","; ascmWipRequirementOperations.getMaterialString += ascmWipRequirementOperations.wmsPreparationQuantity.ToString(); ascmWipRequirementOperations.wmsPreparationQuantity = 0; ascmWipRequirementOperations.modifyTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm"); ascmWipRequirementOperations.modifyUser = userName; list.Add(ascmWipRequirementOperations); } } } } }
public bool ConfrimedGetMaterial(string ticket, string name, string releaseHeaderIds, ref string message) { try { message = ""; if (!IsTicketValid(ticket)) throw new Exception("票证验证失败!"); string userRole = string.Empty; bool Flag = false; List<YnRole> listYnRole = YnRoleService.GetInstance().GetListInUser(name); int nI = 0; foreach (YnRole role in listYnRole) { if (role.name == "领料员") { nI++; } } if (nI > 0) { userRole = name; } //验证任务是否在执行中 string sql = "from AscmGetMaterialTask"; string where = "", whereQueryWord = ""; if (!string.IsNullOrEmpty(releaseHeaderIds)) whereQueryWord = "id in (" + releaseHeaderIds + ")"; where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord); if (!string.IsNullOrEmpty(where)) sql += " where " + where; IList<AscmGetMaterialTask> ilistGetMaterialTask = YnDaoHelper.GetInstance().nHibernateHelper.Find<AscmGetMaterialTask>(sql); if (ilistGetMaterialTask.Count == 0 || ilistGetMaterialTask == null) throw new Exception("查询异常!"); int iTaskCount = 0; foreach (AscmGetMaterialTask ascmGetMaterialTask in ilistGetMaterialTask) { if (ascmGetMaterialTask.status != "EXECUTE") { iTaskCount++; } } if (iTaskCount > 0) throw new Exception("所选任务未在执行中!"); //更新领料数量 sql = "from AscmWipRequirementOperations"; where = ""; if (!string.IsNullOrEmpty(releaseHeaderIds)) whereQueryWord = "taskId in (" + releaseHeaderIds + ")"; where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord); if (!string.IsNullOrEmpty(where)) sql += " where " + where; IList<AscmWipRequirementOperations> ilistRequirementOperations = YnDaoHelper.GetInstance().nHibernateHelper.Find<AscmWipRequirementOperations>(sql); if (ilistRequirementOperations.Count > 0 && ilistRequirementOperations != null) { List<AscmWipRequirementOperations> listRequirementOperations = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList<AscmWipRequirementOperations>(ilistRequirementOperations); List<AscmWipRequirementOperations> newlist = new List<AscmWipRequirementOperations>(); List<WmsAndLogistics> listWmsAndLogistics = new List<WmsAndLogistics>(); foreach (AscmWipRequirementOperations ascmWipRequirementOperations in listRequirementOperations) { if (ascmWipRequirementOperations.wmsPreparationQuantity > 0) { WmsAndLogistics wmsAndLogistics = new WmsAndLogistics(); wmsAndLogistics.wipEntityId = ascmWipRequirementOperations.wipEntityId; wmsAndLogistics.materialId = ascmWipRequirementOperations.inventoryItemId; wmsAndLogistics.quantity = ascmWipRequirementOperations.wmsPreparationQuantity; if (!string.IsNullOrEmpty(ascmWipRequirementOperations.wmsPreparationString)) { string[] strarr = ascmWipRequirementOperations.wmsPreparationString.Split(','); foreach (string str in strarr) { string temp = str.Substring(0, str.IndexOf('[')); if (!string.IsNullOrEmpty(wmsAndLogistics.preparationString)) wmsAndLogistics.preparationString += ","; wmsAndLogistics.preparationString += temp; } } wmsAndLogistics.workerId = name; listWmsAndLogistics.Add(wmsAndLogistics); ascmWipRequirementOperations.getMaterialQuantity += ascmWipRequirementOperations.wmsPreparationQuantity; if (!string.IsNullOrEmpty(ascmWipRequirementOperations.getMaterialString)) ascmWipRequirementOperations.getMaterialString += ","; ascmWipRequirementOperations.getMaterialString += ascmWipRequirementOperations.wmsPreparationQuantity.ToString(); ascmWipRequirementOperations.wmsPreparationQuantity = 0; ascmWipRequirementOperations.modifyTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm"); ascmWipRequirementOperations.modifyUser = name; newlist.Add(ascmWipRequirementOperations); } } if (newlist.Count > 0 && listWmsAndLogistics.Count > 0) { WmsAndLogisticsService.GetInstance().DoMaterialRequisition(listWmsAndLogistics); AscmWipRequirementOperationsService.GetInstance().Update(newlist); Flag = true; } if (Flag) { message = "领料数据已提交!"; return true; } } } catch (Exception ex) { message = ex.Message; } return false; }
public ActionResult ConfrimedGetMaterial(int? page, int? rows, string sort, string order, string queryWord, string releaseHeaderIds) { List<AscmGetMaterialTask> list = null; JsonDataGridResult jsonDataGridResult = new JsonDataGridResult(); string userName = string.Empty; string userRole = string.Empty; bool Flag = false; if (User.Identity.IsAuthenticated) { userName = User.Identity.Name; } userRole = AscmUserInfoService.GetInstance().GetUserRoleName(userName); try { //验证任务是否在执行中 string sql = "from AscmGetMaterialTask"; string where = "", whereQueryWord = ""; if (!string.IsNullOrEmpty(releaseHeaderIds)) whereQueryWord = "id in (" + releaseHeaderIds + ")"; where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord); if (!string.IsNullOrEmpty(where)) sql += " where " + where; IList<AscmGetMaterialTask> ilistGetMaterialTask = YnDaoHelper.GetInstance().nHibernateHelper.Find<AscmGetMaterialTask>(sql); if (ilistGetMaterialTask.Count == 0 || ilistGetMaterialTask == null) throw new Exception("查询异常!"); int iTaskCount = 0; foreach (AscmGetMaterialTask ascmGetMaterialTask in ilistGetMaterialTask) { if (ascmGetMaterialTask.status != "EXECUTE") { iTaskCount++; } } if (iTaskCount > 0) throw new Exception("所选包含未在执行中任务!"); //更新领料数量 sql = "from AscmWipRequirementOperations"; where = ""; if (!string.IsNullOrEmpty(releaseHeaderIds)) whereQueryWord = "taskId in (" + releaseHeaderIds + ")"; where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord); if (!string.IsNullOrEmpty(where)) sql += " where " + where; IList<AscmWipRequirementOperations> ilistRequirementOperations = YnDaoHelper.GetInstance().nHibernateHelper.Find<AscmWipRequirementOperations>(sql); if (ilistRequirementOperations.Count > 0 && ilistRequirementOperations != null) { List<AscmWipRequirementOperations> listRequirementOperations = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList<AscmWipRequirementOperations>(ilistRequirementOperations); List<AscmWipRequirementOperations> newlist = new List<AscmWipRequirementOperations>(); List<WmsAndLogistics> listWmsAndLogistics = new List<WmsAndLogistics>(); foreach (AscmWipRequirementOperations ascmWipRequirementOperations in listRequirementOperations) { if (ascmWipRequirementOperations.wmsPreparationQuantity > 0) { WmsAndLogistics wmsAndLogistics = new WmsAndLogistics(); wmsAndLogistics.wipEntityId = ascmWipRequirementOperations.wipEntityId; wmsAndLogistics.materialId = ascmWipRequirementOperations.inventoryItemId; wmsAndLogistics.quantity = ascmWipRequirementOperations.wmsPreparationQuantity; if (!string.IsNullOrEmpty(ascmWipRequirementOperations.wmsPreparationString)) { if (ascmWipRequirementOperations.wmsPreparationString.IndexOf(',') > -1) { string[] strarr = ascmWipRequirementOperations.wmsPreparationString.Split(','); foreach (string str in strarr) { if (!string.IsNullOrEmpty(str)) { string temp = str.Substring(0, str.IndexOf('[')); if (!string.IsNullOrEmpty(wmsAndLogistics.preparationString)) wmsAndLogistics.preparationString += ","; wmsAndLogistics.preparationString += temp; } } } else { string temp = ascmWipRequirementOperations.wmsPreparationString.Substring(0, ascmWipRequirementOperations.wmsPreparationString.IndexOf('[')); wmsAndLogistics.preparationString += temp; } } wmsAndLogistics.workerId = userName; listWmsAndLogistics.Add(wmsAndLogistics); ascmWipRequirementOperations.getMaterialQuantity += ascmWipRequirementOperations.wmsPreparationQuantity; if (!string.IsNullOrEmpty(ascmWipRequirementOperations.getMaterialString)) ascmWipRequirementOperations.getMaterialString += ","; ascmWipRequirementOperations.getMaterialString += ascmWipRequirementOperations.wmsPreparationQuantity.ToString(); ascmWipRequirementOperations.wmsPreparationQuantity = 0; ascmWipRequirementOperations.modifyTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm"); ascmWipRequirementOperations.modifyUser = userName; newlist.Add(ascmWipRequirementOperations); } } if (newlist.Count > 0 && listWmsAndLogistics.Count > 0) { WmsAndLogisticsService.GetInstance().DoMaterialRequisition(listWmsAndLogistics); AscmWipRequirementOperationsService.GetInstance().Update(newlist); Flag = true; } } //记录领料异常时间点 if (Flag) { sql = "from AscmGetMaterialTask"; where = ""; if (!string.IsNullOrEmpty(releaseHeaderIds)) whereQueryWord = "id in (" + releaseHeaderIds + ")"; where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord); if (!string.IsNullOrEmpty(where)) sql += " where " + where; IList<AscmGetMaterialTask> ilistAscmGetMaterialTask = YnDaoHelper.GetInstance().nHibernateHelper.Find<AscmGetMaterialTask>(sql); if (ilistAscmGetMaterialTask != null && ilistAscmGetMaterialTask.Count > 0) { List<AscmGetMaterialTask> listAscmGetMaterialTask = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList<AscmGetMaterialTask>(ilistAscmGetMaterialTask); foreach (AscmGetMaterialTask ascmGetMaterialTask in listAscmGetMaterialTask) { if (!string.IsNullOrEmpty(ascmGetMaterialTask.errorTime)) ascmGetMaterialTask.errorTime += ","; if (!string.IsNullOrEmpty(ascmGetMaterialTask.starTime)) ascmGetMaterialTask.endTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm"); ascmGetMaterialTask.errorTime += DateTime.Now.ToString("yyyy-MM-dd HH:mm"); ascmGetMaterialTask.modifyTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm"); ascmGetMaterialTask.modifyUser = userName; } AscmGetMaterialTaskService.GetInstance().Update(listAscmGetMaterialTask); } } //刷新列表 YnBaseDal.YnPage ynPage = new YnBaseDal.YnPage(); ynPage.SetPageSize(rows.HasValue ? rows.Value : YnBaseDal.YnPage.DEFAULT_PAGE_SIZE); //pageRows; ynPage.SetCurrentPage(page.HasValue ? page.Value : 1); //pageNumber; sql = "from AscmGetMaterialTask"; where = ""; whereQueryWord = "status != 'NOTALLOCATE'"; where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord); if (!string.IsNullOrEmpty(userRole)) { whereQueryWord = "workerId = '" + userRole + "'"; where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord); } if (!string.IsNullOrEmpty(where)) sql += " where " + where; IList<AscmGetMaterialTask> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find<AscmGetMaterialTask>(sql, sql, ynPage); if (ilist != null && ilist.Count > 0) { list = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList<AscmGetMaterialTask>(ilist); AscmGetMaterialTaskService.GetInstance().SetRanker(list); AscmGetMaterialTaskService.GetInstance().SetWorker(list); AscmGetMaterialTaskService.GetInstance().SumQuantity(list); foreach (AscmGetMaterialTask ascmGetMaterialTask in list) { jsonDataGridResult.rows.Add(ascmGetMaterialTask); } } jsonDataGridResult.result = true; jsonDataGridResult.total = ynPage.GetRecordCount(); if (Flag) { jsonDataGridResult.message = "领料数据已提交!"; } } catch (Exception ex) { jsonDataGridResult.message = ex.Message; } return Json(jsonDataGridResult, JsonRequestBehavior.AllowGet); }
public bool InvokeModulInterface() { try { string whereOther = "", whereQueryWord = ""; whereQueryWord = "status = " + AscmGetMaterialLog.StatusDefine.normalStatus; whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereQueryWord); List<AscmGetMaterialLog> list = AscmGetMaterialLogService.GetInstance().GetList(null, "", "", "", whereOther); if (list != null && list.Count > 0) { List<WmsAndLogistics> InterfaceList = new List<WmsAndLogistics>(); foreach (AscmGetMaterialLog ascmGetMaterialLog in list) { WmsAndLogistics wmsAndLogistics = new WmsAndLogistics(); wmsAndLogistics.wipEntityId = ascmGetMaterialLog.wipEntityId; wmsAndLogistics.materialId = ascmGetMaterialLog.materialId; wmsAndLogistics.warehouseId = ascmGetMaterialLog.warehouseId; wmsAndLogistics.quantity = ascmGetMaterialLog.quantity; wmsAndLogistics.preparationString = ascmGetMaterialLog.preparationString; wmsAndLogistics.workerId = ascmGetMaterialLog.workerId; InterfaceList.Add(wmsAndLogistics); } //调用接口 WmsAndLogisticsService.GetInstance().DoMaterialRequisition(InterfaceList); foreach (AscmGetMaterialLog ascmGetMaterialLog in list) { ascmGetMaterialLog.status = AscmGetMaterialLog.StatusDefine.abnormalSatus; } //更新领料信息 AscmGetMaterialLogService.GetInstance().Update(list); result = true; } } catch (Exception ex) { YnBaseClass2.Helper.LogHelper.GetLog().Error("确认领料失败!(Confrim AscmGetMateiralTask)", ex); throw ex; } return result; }