/// <summary> /// /// </summary> /// <param name="fields"></param> /// <param name="id"></param> /// <returns></returns> public bool UpdateInfo(string fields, long id) { ///工位名称④、顺序号⑥在同一工段中不允许重复 string locationName = CommonBLL.GetFieldValue(fields, "LOCATION_NAME"); string workshopSection = CommonBLL.GetFieldValue(fields, "WORKSHOP_SECTION"); if (string.IsNullOrEmpty(locationName)) { throw new Exception("MC:0x00000087");///工位名称不能为空 } if (string.IsNullOrEmpty(workshopSection)) { throw new Exception("MC:0x00000088");///工段代码不能为空 } int cnt = dal.GetCounts("[ID] <> " + id + " and [LOCATION_NAME] = N'" + locationName + "' and [WORKSHOP_SECTION] = N'" + workshopSection + "'"); if (cnt > 0) { throw new Exception("Err_:MC:0x00000194"); } ///顺序号可空,判断会复杂一些 string sequenceNo = CommonBLL.GetFieldValue(fields, "SEQUENCE_NO"); if (!string.IsNullOrEmpty(sequenceNo) && sequenceNo.Trim() != "null" && sequenceNo.Trim() != "0") { cnt = dal.GetCounts("[ID] <> " + id + " and [SEQUENCE_NO] = " + sequenceNo + " and [WORKSHOP_SECTION] = N'" + workshopSection + "'"); if (cnt > 0) { throw new Exception("Err_:MC:0x00000195"); } } return(dal.UpdateInfo(fields, id) > 0 ? true : false); }
/// <summary> /// UpdateInfo /// </summary> /// <param name="fields"></param> /// <param name="id"></param> /// <returns></returns> public bool UpdateInfo(string fields, long id) { string statusPointName = CommonBLL.GetFieldValue(fields, "STATUS_POINT_NAME"); int cnt = dal.GetCounts("[ID] <> " + id + " and [STATUS_POINT_NAME] = N'" + statusPointName + "'"); if (cnt > 0) { throw new Exception("MC:0x00000286");///状态点名称重复 } string statusPointSeq = CommonBLL.GetFieldValue(fields, "STATUS_POINT_SEQ"); if (string.IsNullOrEmpty(statusPointSeq)) { throw new Exception("MC:0x00000341");///状态点顺序为必填项 } string assemblyLine = CommonBLL.GetFieldValue(fields, "ASSEMBLY_LINE"); cnt = dal.GetCounts("[ID] <> " + id + " and [ASSEMBLY_LINE] = N'" + assemblyLine + "' and [STATUS_POINT_SEQ] = N'" + statusPointSeq + "'"); if (cnt > 0) { throw new Exception("MC:0x00000287");///同一生产线范围内不能重复填写状态点顺序 } ///TODO:工位⑤在同一生产线⑦下的状态点不能重复设置 return(dal.UpdateInfo(fields, id) > 0 ? true : false); }
/// <summary> /// 按主键、字段更新数据 /// </summary> /// <param name="fields"></param> /// <param name="id"></param> /// <returns>是否更新成功</returns> public bool UpdateInfo(string fields, long id) { string custCode = CommonBLL.GetFieldValue(fields, "CUST_CODE"); int cnt = dal.GetCounts("[ID] <> " + id + " and [CUST_CODE] = N'" + custCode + "'"); if (cnt > 0) { throw new Exception("MC:0x00000081");///客户代码不允许重复 } string custName = CommonBLL.GetFieldValue(fields, "CUST_NAME"); cnt = dal.GetCounts("[ID] <> " + id + " and [CUST_NAME] = N'" + custName + "'"); if (cnt > 0) { throw new Exception("MC:0x00000082");///客户名称不允许重复 } string custNickname = CommonBLL.GetFieldValue(fields, "CUST_NICKNAME"); cnt = dal.GetCounts("[ID] <> " + id + " and [CUST_NICKNAME] = N'" + custNickname + "'"); if (cnt > 0) { throw new Exception("MC:0x00000083");///客户简称不允许重复 } return(dal.UpdateInfo(fields, id) > 0 ? true : false); }
/// <summary> /// /// </summary> /// <param name="fields"></param> /// <param name="id"></param> /// <returns></returns> public bool UpdateInfo(string fields, long id) { ///生产线名称③同一车间代码下不允许重复 string assemblyLineName = CommonBLL.GetFieldValue(fields, "ASSEMBLY_LINE_NAME"); string workshop = CommonBLL.GetFieldValue(fields, "WORKSHOP"); if (string.IsNullOrEmpty(assemblyLineName)) { throw new Exception("MC:0x00000078");///生产线名称不能为空 } if (string.IsNullOrEmpty(workshop)) { throw new Exception("MC:0x00000079");///车间代码不能为空 } int cnt = dal.GetCounts("[ID] <> " + id + " and [ASSEMBLY_LINE_NAME] = N'" + assemblyLineName + "' and [WORKSHOP] = N'" + workshop + "'"); if (cnt > 0) { throw new Exception("MC:0x00000168");///流水线名称重复 } ///生产线简称④不允许重复,单字段进行全表校验 string assembly_line_nickname = CommonBLL.GetFieldValue(fields, "ASSEMBLY_LINE_NICKNAME"); if (assembly_line_nickname.ToUpper() == "NULL") { assembly_line_nickname = string.Empty; } cnt = dal.GetCounts("[ID] <> " + id + " and [ASSEMBLY_LINE_NICKNAME] = N'" + assembly_line_nickname + "'"); if (cnt > 0 && !string.IsNullOrEmpty(assembly_line_nickname)) { throw new Exception("MC:0x00000169");///流水线简称重复 } return(dal.UpdateInfo(fields, id) > 0 ? true : false); }
/// <summary> /// UpdateInfo /// </summary> /// <param name="fields"></param> /// <param name="id"></param> /// <returns></returns> public bool UpdateInfo(string fields, long id) { ///包装器具基础数据同步VMI系统标记 string vmiBasPackageSyncFlag = new ConfigBLL().GetValueByCode("VMI_BAS_PACKAGE_SYNC_FLAG"); string sql = string.Empty; if (vmiBasPackageSyncFlag.ToLower() == "true") { string supplierNum = CommonBLL.GetFieldValue(fields, "SUPPLIER_NUM"); if (!string.IsNullOrEmpty(supplierNum)) { Guid logFid = Guid.NewGuid(); string packageNo = CommonBLL.GetFieldValue(fields, "PACKAGE_NO"); string packageCname = CommonBLL.GetFieldValue(fields, "PACKAGE_CNAME"); string packageType = CommonBLL.GetFieldValue(fields, "PACKAGE_TYPE"); string loginUser = CommonBLL.GetFieldValue(fields, "MODIFY_USER"); sql += "insert into [LES].[TI_IFM_WMS_VMI_PACKAGE] (" + "[FID],[LOG_FID],[SKU],[SKUDESCR],[SKUCLS],[SUPPLYCODE]," + "[VALID_FLAG],[CREATE_USER],[CREATE_DATE],[PROCESS_FLAG]) values (" + "NEWID(),N'" + logFid + "',N'" + packageNo + "',N'" + packageCname + "',N'" + packageType + "',N'" + supplierNum + "'," + "1,N'" + loginUser + "',GETDATE()," + (int)ProcessFlagConstants.Untreated + ");"; sql += CommonBLL.GetCreateOutboundLogSql("VMI", logFid, "LES-WMS-015", packageNo, loginUser); } } using (var trans = new TransactionScope()) { if (!string.IsNullOrEmpty(sql)) { CommonDAL.ExecuteNonQueryBySql(sql); } dal.UpdateInfo(fields, id); trans.Complete(); } return(true); }
/// <summary> /// /// </summary> /// <param name="fields"></param> /// <param name="id"></param> /// <returns></returns> public bool UpdateInfo(string fields, long id) { PlanPullOrderInfo info = dal.GetInfo(id); if (info.OrderStatus.GetValueOrDefault() != (int)PullOrderStatusConstants.Created) { throw new Exception("MC:0x00000683");///状态必须为已创建 } ///如果填写了客户委托编号则需要在此时更新对应入库单、出库单、应收、应付中的委托编号 string custTrustNo = CommonBLL.GetFieldValue(fields, "CUST_TRUST_NO"); string sql = string.Empty; if (!string.IsNullOrEmpty(custTrustNo) && custTrustNo != info.CustTrustNo) { string loginUser = CommonBLL.GetFieldValue(fields, "MODIFY_USER"); sql += "update [LES].[TT_WMM_RECEIVE] set [ASN_NO] = N'" + custTrustNo + "',[MODIFY_USER] = N'" + loginUser + "',[MODIFY_DATE] = GETDATE() where [RUNSHEET_NO] = N'" + info.OrderCode + "' and [VALID_FLAG] = 1;"; sql += "update [LES].[TT_WMM_OUTPUT] set [ASN_NO] = N'" + custTrustNo + "',[MODIFY_USER] = N'" + loginUser + "',[MODIFY_DATE] = GETDATE() where [RUNSHEET_NO] = N'" + info.OrderCode + "' and [VALID_FLAG] = 1;"; sql += "update [LES].[TT_FIM_BUSINESS_EXPENSE_IN] set [CUST_TRUST_NO] = N'" + custTrustNo + "',[MODIFY_USER] = N'" + loginUser + "',[MODIFY_DATE] = GETDATE() where [ORDER_NO] = N'" + info.OrderCode + "' and [VALID_FLAG] = 1;"; sql += "update [LES].[TT_FIM_BUSINESS_EXPENSE_OUT] set [CUST_TRUST_NO] = N'" + custTrustNo + "',[MODIFY_USER] = N'" + loginUser + "',[MODIFY_DATE] = GETDATE() where [ORDER_NO] = N'" + info.OrderCode + "' and [VALID_FLAG] = 1;"; } ///执行 using (TransactionScope trans = new TransactionScope()) { if (!string.IsNullOrEmpty(sql)) { CommonDAL.ExecuteNonQueryBySql(sql); } if (dal.UpdateInfo(fields, id) == 0) { return(false); } trans.Complete(); } return(true); }
/// <summary> /// /// </summary> /// <param name="fields"></param> /// <param name="id"></param> /// <returns></returns> public bool UpdateInfo(string fields, long id) { ZonesInfo info = dal.GetInfo(id); if (info == null) { throw new Exception("MC:0x00000084");///数据错误 } ///存储区名称 info.ZoneName = CommonBLL.GetFieldValue(fields, "ZONE_NAME"); ///仓库代码 info.WmNo = CommonBLL.GetFieldValue(fields, "WM_NO"); WarehouseInfo warehouseInfo = new WarehouseDAL().GetWarehouseInfo(info.WmNo); if (warehouseInfo == null) { throw new Exception("MC:0x00000230");///仓库信息不存在 } ///是否结算 string settlement_flag = CommonBLL.GetFieldValue(fields, "SETTLEMENT_FLAG"); if (bool.TryParse(settlement_flag, out bool bool_settlement_flag)) { info.Settlementflag = bool_settlement_flag; } ///SAP库存地点 info.StockPlaceNo = CommonBLL.GetFieldValue(fields, "STOCK_PLACE_NO"); ///允许存储区代码在不同的仓库中重复使用 string allow_zoneno_repeat_at_different_warehouse = new ConfigDAL().GetValueByCode("ALLOW_ZONENO_REPEAT_AT_DIFFERENT_WAREHOUSE"); ///数据校验 ValidInfo(info, allow_zoneno_repeat_at_different_warehouse); return(dal.UpdateInfo(fields, id) > 0 ? true : false); }
public bool UpdateInfo(string fields, long id) { InventoryNoticeOrderInfo inventoryNoticeOrderInfo = new InventoryNoticeOrderDAL().GetList("[FID] = N'" + CommonBLL.GetFieldValue(fields, "ORDER_FID") + "'", string.Empty).FirstOrDefault(); if (inventoryNoticeOrderInfo.Status != (int)InventoryOrderStatusConstants.PUBLISHED) { throw new Exception("MC:0x00000372");///状态为20.已发布的盘点单只允许修改物料的物料盘点数量以及备注,此时的修改同时计算出两个差异值 } string partQty = CommonBLL.GetFieldValue(fields, "PART_QTY"); bool regular = Regex.IsMatch(partQty, @"^(^-?|^\+?|\d)\d+$"); if (regular == false) { regular = Regex.IsMatch(partQty, @"^(^-?|^\+?|^\d?)\d*\.\d+$"); if (regular == false) { throw new Exception("MC:0x00000381");///物料盘点数量的数据格式不正确,请输入数字格式 } } InventoryOrderPartInfo inventory = dal.GetInfo(id); if (inventory == null) { throw new Exception("MC:0x00000084");///数据错误 } int differenceQty = Convert.ToInt32(partQty) - Convert.ToInt32(inventory.ReferenceQty); int sapDqty = Convert.ToInt32(partQty) - Convert.ToInt32(inventory.SapMenge); fields += ",[DIFFERENCE_QTY] = N'" + differenceQty + "'"; fields += ",[SAP_DQTY] = N'" + sapDqty + "'"; return(dal.UpdateInfo(fields, id) > 0 ? true : false); }
/// <summary> /// /// </summary> /// <param name="fields"></param> /// <param name="id"></param> /// <returns></returns> public bool UpdateInfo(string fields, long id) { string plant = CommonBLL.GetFieldValue(fields, "PLANT"); string workshop = CommonBLL.GetFieldValue(fields, "WORKSHOP"); string assemblyLine = CommonBLL.GetFieldValue(fields, "ASSEMBLY_LINE"); DateTime date = DateTime.Parse(CommonBLL.GetFieldValue(fields, "DATE")); DateTime beginTime = DateTime.Parse(CommonBLL.GetFieldValue(fields, "BEGIN_TIME")); DateTime endTime = DateTime.Parse(CommonBLL.GetFieldValue(fields, "END_TIME")); /// beginTime = DateTime.Parse(date.ToString("yyyy-MM-dd") + " " + beginTime.ToString("HH:mm")); endTime = DateTime.Parse(date.ToString("yyyy-MM-dd") + " " + endTime.ToString("HH:mm")); //还需校验相同维度下开始时间+结束时间为时间范围,各条数据之间时间范围不能交叉, //例如相同工厂代码①、车间代码②、产线代码③下已维护了2018-03-17 08:00:00至 2018-03-17 16:00:00的数据, //再维护2018-03-17 15:00:00至 2018-03-18 06:00:00的数据保存时需要报错 if (beginTime >= endTime) { endTime = endTime.AddDays(1); } int cnt = dal.GetCounts(string.Format(@"and [PLANT] = N'{0}' and [WORKSHOP] = N'{1}' and [ASSEMBLY_LINE] = N'{2}' " + "and (([BEGIN_TIME]< N'{3}' and [END_TIME] > N'{3}') or ([END_TIME] > N'{4}' and [BEGIN_TIME] < N'{4}') or ([BEGIN_TIME] > N'{3}' and [BEGIN_TIME] < N'{4}') or ([END_TIME] > N'{3}' and [END_TIME] < N'{4}')) and [ID] <>{5}" , plant, workshop, assemblyLine, beginTime, endTime, id)); if (cnt > 0) { throw new Exception("Err_:MC:0x00000199"); } /// fields = CommonBLL.SetFieldValue(fields, "BEGIN_TIME", beginTime.ToString("yyyy-MM-dd HH:mm:ss")); fields = CommonBLL.SetFieldValue(fields, "END_TIME", endTime.ToString("yyyy-MM-dd HH:mm:ss")); return(dal.UpdateInfo(fields, id) > 0 ? true : false); }
/// <summary> /// /// </summary> /// <param name="fields"></param> /// <param name="id"></param> /// <returns></returns> public bool UpdateInfo(string fields, long id) { ///发单状态⑪为10未发单才允许被修改 string sendTimeStatus = CommonBLL.GetFieldValue(fields, "SEND_TIME_STATUS"); if (Convert.ToInt32(sendTimeStatus) != (int)SendTimeStatusConstants.NoSend) { throw new Exception("Err_:MC:0x00000741");///未发单状态窗口时间才允许修改 } string windowTime = CommonBLL.GetFieldValue(fields, "WINDOW_TIME"); string workDay = CommonBLL.GetFieldValue(fields, "WORK_DAY"); string partBoxCode = CommonBLL.GetFieldValue(fields, "PART_BOX_CODE"); PlanPartBoxInfo planPartBoxInfo = new PlanPartBoxDAL().GetInfo(partBoxCode); if (planPartBoxInfo == null) { throw new Exception("Err_:MC:0x00000738");///请选择有效的零件类代码 } ///工作日⑧默认为当天日期,在窗口时间⑩填写完成时自动根据零件类中对应的几个时间合计扣减得到发单时间⑨,发单时间⑨不可编辑 DateTime windowDateTime = DateTime.Parse(DateTime.Parse(workDay).ToString("yyyy-MM-dd") + " " + DateTime.Parse(windowTime).ToString("HH:mm:ss")); int sumTime = planPartBoxInfo.PickUpTime.GetValueOrDefault() + planPartBoxInfo.DeliveryTime.GetValueOrDefault() + planPartBoxInfo.DelayTime.GetValueOrDefault(); DateTime sendDateTime = windowDateTime.AddMinutes(sumTime * -1); fields = CommonBLL.SetFieldValue(fields, "WINDOW_TIME", windowDateTime.ToString("yyyy-MM-dd HH:mm:ss")); fields = CommonBLL.SetFieldValue(fields, "SEND_TIME", sendDateTime.ToString("yyyy-MM-dd HH:mm:ss")); ///相同零件类代码②、工作日⑧、窗口时间⑩的数据不允许重复 int cnt = dal.GetCounts("[ID] <> " + id + " and [PART_BOX_CODE] = N'" + partBoxCode + "' and [WINDOW_TIME] = N'" + windowDateTime + "'"); if (cnt > 0) { throw new Exception("Err_:MC:0x00000740");///相同零件类、工作日的窗口时间不能重复 } return(dal.UpdateInfo(fields, id) > 0 ? true : false); }
/// <summary> /// /// </summary> /// <param name="fields"></param> /// <param name="id"></param> /// <returns></returns> public bool UpdateInfo(string fields, long id) { WarehouseLocationInfo info = dal.GetInfo(id); if (info == null) { throw new Exception("MC:0x00000084");///数据错误 } ///仓库 info.WmNo = CommonBLL.GetFieldValue(fields, "WM_NO"); WarehouseInfo warehouseInfo = new WarehouseDAL().GetWarehouseInfo(info.WmNo); if (warehouseInfo == null) { throw new Exception("MC:0x00000230");///仓库信息不存在 } ///存储区 info.ZoneNo = CommonBLL.GetFieldValue(fields, "ZONE_NO"); ZonesInfo zonesInfo = new ZonesDAL().GetZonesInfo(info.ZoneNo, info.WmNo); if (zonesInfo == null) { throw new Exception("MC:0x00000500");///存储区不存在 } ///库位名称 info.StorageLocationName = CommonBLL.GetFieldValue(fields, "STORAGE_LOCATION_NAME"); ///允许存储区代码在不同的仓库中重复使用 string allow_zoneno_repeat_at_different_warehouse = new ConfigDAL().GetValueByCode("ALLOW_ZONENO_REPEAT_AT_DIFFERENT_WAREHOUSE"); ///允许库位代码在不同的存储区中重复使用 string allowDlocRepeatAtDifferentZone = new ConfigDAL().GetValueByCode("ALLOW_DLOC_REPEAT_AT_DIFFERENT_ZONE"); ///数据校验 ValidInfo(info, allow_zoneno_repeat_at_different_warehouse, allowDlocRepeatAtDifferentZone); return(dal.UpdateInfo(fields, id) > 0 ? true : false); }
/// <summary> /// UpdateInfo /// </summary> /// <param name="fields"></param> /// <param name="id"></param> /// <returns></returns> public bool UpdateInfo(string fields, long id) { ///仓库名称②不允许重复 string warehouseName = CommonBLL.GetFieldValue(fields, "WAREHOUSE_NAME"); if (string.IsNullOrEmpty(warehouseName)) { throw new Exception("MC:0x00000721");///仓库名称不允许为空 } int cnt = dal.GetCounts("[ID] <> " + id + " and [WAREHOUSE_NAME] = N'" + warehouseName + "'"); if (cnt > 0) { throw new Exception("MC:0x00000160");///仓库名称重复 } ///如选定仓库类型为外部仓库VMI时,新增或更新供应商信息中的储运供应商 string warehouse = CommonBLL.GetFieldValue(fields, "WAREHOUSE"); string modifyUser = CommonBLL.GetFieldValue(fields, "MODIFY_USER"); string warehouseType = CommonBLL.GetFieldValue(fields, "WAREHOUSE_TYPE"); WarehouseInfo warehouseInfo = new WarehouseInfo(); warehouseInfo.Warehouse = warehouse; warehouseInfo.WarehouseName = warehouseName; int intWarehouseType = 0; int.TryParse(warehouseType, out intWarehouseType); warehouseInfo.WarehouseType = intWarehouseType; new SupplierBLL().SyncSupplierByWarehouse(warehouseInfo, modifyUser); /// return(dal.UpdateInfo(fields, id) > 0 ? true : false); }
/// <summary> /// /// </summary> /// <param name="fields"></param> /// <param name="id"></param> /// <returns></returns> public bool UpdateInfo(string fields, long id) { SupplierPartQuotaInfo supplierPartQuotaInfo = dal.GetInfo(id); if (supplierPartQuotaInfo == null) { throw new Exception("MC:0x00000084");///数据错误 } string loginUser = CommonBLL.GetFieldValue(fields, "MODIFY_USER"); ///生成中间表同步数据 string sql = GetSyncVmiSupplierPartSql(supplierPartQuotaInfo, false, loginUser); using (TransactionScope trans = new TransactionScope()) { if (dal.UpdateInfo(fields, id) == 0) { return(false); } if (sql.Length > 0) { CommonDAL.ExecuteNonQueryBySql(sql); } trans.Complete(); } return(true); }
/// <summary> /// UpdateInfo /// </summary> /// <param name="fields"></param> /// <param name="id"></param> /// <returns></returns> public bool UpdateInfo(string fields, long id) { string scanPointName = CommonBLL.GetFieldValue(fields, "SCAN_POINT_NAME"); int scanPointNameCnt = dal.GetCounts("[ID] <> " + id + " and [SCAN_POINT_NAME] = N'" + scanPointName + "'"); if (scanPointNameCnt > 0) { throw new Exception("MC:0x00000281");///扫描点名称不能重复 } return(dal.UpdateInfo(fields, id) > 0 ? true : false); }
/// <summary> /// UpdateInfo /// </summary> /// <param name="fields"></param> /// <param name="id"></param> /// <returns></returns> public bool UpdateInfo(string fields, long id) { string contractNo = CommonBLL.GetFieldValue(fields, "CONTRACT_NO"); int cnt = dal.GetCounts("[ID] <> " + id + " and [CONTRACT_NO] = N'" + contractNo + "'"); if (cnt > 0) { throw new Exception("MC:0x00000109");///合同编号不允许重复 } return(dal.UpdateInfo(fields, id) > 0 ? true : false); }
/// <summary> /// /// </summary> /// <param name="fields"></param> /// <param name="id"></param> /// <returns></returns> public bool UpdateInfo(string fields, long id) { string itemName = CommonBLL.GetFieldValue(fields, "ITEM_NAME"); int cnt = dal.GetCounts("[ID] <> " + id + " and [ITEM_NAME] = N'" + itemName + "' and [CODE_FID] = N'" + codeFid + "'"); if (cnt > 0) { throw new Exception("MC:0x00000119");///进仓类型不能重复 } return(dal.UpdateInfo(fields, id) > 0 ? true : false); }
/// <summary> /// /// </summary> /// <param name="fields"></param> /// <param name="id"></param> /// <returns></returns> public bool UpdateInfo(string fields, long id) { ///路径名称单字段全表范围不允许重复 string routeName = CommonBLL.GetFieldValue(fields, "ROUTE_NAME"); int cnt = dal.GetCounts("[ID] <> " + id + " and [ROUTE_NAME] = N'" + routeName + "'"); if (cnt > 0) { throw new Exception("MC:0x00000312");///路径名称重复 } return(dal.UpdateInfo(fields, id) > 0 ? true : false); }
/// <summary> /// /// </summary> /// <param name="fields"></param> /// <param name="id"></param> /// <returns></returns> public bool UpdateInfo(string fields, long id) { ///来源存储区⑤与目标存储区⑦不能为同一存储区 string sourceZoneNo = CommonBLL.GetFieldValue(fields, "SOURCE_ZONE_NO"); string targetZoneNo = CommonBLL.GetFieldValue(fields, "TARGET_ZONE_NO"); if (sourceZoneNo == targetZoneNo) { throw new Exception("Err_:MC:0x00000304"); } return(dal.UpdateInfo(fields, id) > 0 ? true : false); }
/// <summary> /// /// </summary> /// <param name="fields"></param> /// <param name="id"></param> /// <returns></returns> public bool UpdateInfo(string fields, long id) { string routeFid = CommonBLL.GetFieldValue(fields, "ROUTE_FID"); string wmNo = CommonBLL.GetFieldValue(fields, "WM_NO"); string zoneNo = CommonBLL.GetFieldValue(fields, "ZONE_NO"); int cnt = dal.GetCounts("[ROUTE_FID] = N'" + routeFid + "' and [WM_NO] = N'" + wmNo + "' and [ZONE_NO] = N'" + zoneNo + "'"); if (cnt > 0) { throw new Exception("MC:0x00000325");///同一路径下地点不能重复 } return(dal.UpdateInfo(fields, id) > 0 ? true : false); }
/// <summary> /// UpdateInfo /// </summary> /// <param name="fields"></param> /// <param name="id"></param> /// <returns></returns> public bool UpdateInfo(string fields, long id) { string supplierNum = CommonBLL.GetFieldValue(fields, "SUPPLIER_NUM"); string wmNo = CommonBLL.GetFieldValue(fields, "WM_NO"); string zoneNo = CommonBLL.GetFieldValue(fields, "ZONE_NO"); ///仓库代码①、存储区代码②、供应商代码③组合唯一性校验 int cnt = dal.GetCounts(string.Format(@"[SUPPLIER_NUM] = N'{0}' and [WM_NO] = N'{1}' and [ZONE_NO] = N'{2}' and [ID] <> {3}", supplierNum, wmNo, zoneNo, id)); if (cnt > 0) { throw new Exception("MC:0x00000098");///仓库、存储区、供应商组合需唯一 } return(dal.UpdateInfo(fields, id) > 0 ? true : false); }
/// <summary> /// UpdateInfo /// </summary> /// <param name="fields"></param> /// <param name="id"></param> /// <returns></returns> public bool UpdateInfo(string fields, long id) { string measuringUnitNo = CommonBLL.GetFieldValue(fields, "MEASURING_UNIT_NO"); int cnt = dal.GetCounts("[ID] <> " + id + " and [MEASURING_UNIT_NO] = N'" + measuringUnitNo + "'"); if (cnt > 0) { throw new Exception("MC:0x00000106");///计量单位编码不允许重复 } //string measuringUnitName = CommonBLL.GetFieldValue(fields, "MEASURING_UNIT_NAME"); //cnt = dal.GetCounts("[ID] <> " + id + " and [MEASURING_UNIT_NAME] = N'" + measuringUnitName + "'"); //if (cnt > 0) // throw new Exception("MC:0x00000107");///计量单位名称不允许重复 return(dal.UpdateInfo(fields, id) > 0 ? true : false); }
/// <summary> /// /// </summary> /// <param name="fields"></param> /// <param name="id"></param> /// <returns></returns> public bool UpdateInfo(string fields, long id) { ///车间名称③不允许重复 string workshopName = CommonBLL.GetFieldValue(fields, "WORKSHOP_NAME"); if (string.IsNullOrEmpty(workshopName)) { throw new Exception("MC:0x00000102");///车间名称不能为空 } int cnt = dal.GetCounts("[ID] <> " + id + " and [WORKSHOP_NAME] = N'" + workshopName + "'"); if (cnt > 0) { throw new Exception("MC:0x00000166");///车间名称重复 } return(dal.UpdateInfo(fields, id) > 0 ? true : false); }
/// <summary> /// UpdateInfo /// </summary> /// <param name="fields">string</param> /// <param name="id">int</param> /// <returns>bool</returns> public bool UpdateInfo(string fields, long id) { ///工厂名称②不允许重复 string plantName = CommonBLL.GetFieldValue(fields, "PLANT_NAME"); if (string.IsNullOrEmpty(plantName)) { throw new Exception("MC:0x00000096");///工厂名称不能为空 } int cnt = dal.GetCounts("[ID] <> " + id + " and [PLANT_NAME] = N'" + plantName + "'"); if (cnt > 0) { throw new Exception("MC:0x00000164"); } return(dal.UpdateInfo(fields, id) > 0 ? true : false); }
/// <summary> /// UpdateInfo /// </summary> /// <param name="fields"></param> /// <param name="id"></param> /// <returns></returns> public bool UpdateInfo(string fields, long id) { TwdWindowTimeInfo info = dal.GetInfo(id); if (info == null) { throw new Exception("MC:0x00000084");///数据错误 } if (info.SendTimeStatus.GetValueOrDefault() != (int)SendTimeStatusConstants.NoSend) { throw new Exception("MC:0x00000311");///发单状态为未发单才允许被修改 } string partBoxCode = CommonBLL.GetFieldValue(fields, "PART_BOX_CODE"); string workDay = CommonBLL.GetFieldValue(fields, "WORK_DAY"); string windowTime = CommonBLL.GetFieldValue(fields, "WINDOW_TIME"); ///窗口时间 DateTime dateWindowTime = CommonBLL.TryParseDatetime(windowTime, "yyyy-MM-dd HH:mm:ss"); DateTime dateWorkDay = CommonBLL.TryParseDatetime(workDay, "yyyy-MM-dd HH:mm:ss"); dateWindowTime = new DateTime(dateWorkDay.Year, dateWorkDay.Month, dateWorkDay.Day, dateWindowTime.Hour, dateWindowTime.Minute, 0); int cnt = dal.GetCounts("[PART_BOX_CODE] = N'" + info.PartBoxCode + "' and [WINDOW_TIME] = N'" + info.WindowTime.GetValueOrDefault() + "' and [ID] <> " + id + ""); if (cnt > 0) { throw new Exception("MC:0x00000313");///相同零件类代码②、工作日⑧、窗口时间⑩的数据不允许重复 } fields = CommonBLL.SetFieldValue(fields, "WINDOW_TIME", dateWindowTime.ToString("yyyy-MM-dd HH:mm:ss")); TwdPartBoxInfo twdPartBoxInfo = new TwdPartBoxDAL().GetInfo(partBoxCode); if (twdPartBoxInfo == null) { throw new Exception("MC:0x00000225");///拉动零件类数据错误 } ///发单时间 = 工作日年月日 + 窗口时间时分秒 - 提前时间 int advanceTime = twdPartBoxInfo.RequirementAccumulateTime.GetValueOrDefault() + ///累积时间 twdPartBoxInfo.LoadTime.GetValueOrDefault() + ///装货时间 twdPartBoxInfo.TransportTime.GetValueOrDefault() + ///运输时间 twdPartBoxInfo.UnloadTime.GetValueOrDefault(); ///卸货时间 DateTime sendTime = dateWindowTime.AddMinutes(0 - advanceTime); fields = CommonBLL.SetFieldValue(fields, "SEND_TIME", sendTime.ToString("yyyy-MM-dd HH:mm:ss")); return(dal.UpdateInfo(fields, id) > 0 ? true : false); }
/// <summary> /// UpdateInfo /// </summary> /// <param name="fields"></param> /// <param name="id"></param> /// <returns></returns> public bool UpdateInfo(string fields, long id) { string expenseCode = CommonBLL.GetFieldValue(fields, "EXPENSE_CODE"); int cnt = dal.GetCounts("[ID] <> " + id + " and [EXPENSE_CODE] = N'" + expenseCode + "'"); if (cnt > 0) { throw new Exception("MC:0x00000321"); ///费用代码不允许重复 } string expenseName = CommonBLL.GetFieldValue(fields, "EXPENSE_NAME"); cnt = dal.GetCounts("[ID] <> " + id + " and [EXPENSE_NAME] = N'" + expenseName + "'"); if (cnt > 0) { throw new Exception("MC:0x00000322"); ///费用名称不允许重复 } return(dal.UpdateInfo(fields, id) > 0 ? true : false); }
/// <summary> /// UpdateInfo /// </summary> /// <param name="fields">更新字段</param> /// <returns></returns> public bool UpdateInfo(string fields, long id) { BomRepleaceConditionInfo info = dal.GetInfo(id); if (info == null) { throw new Exception("MC:0x00000084");///数据错误 } if (info.Status != (int)BreakPointOrderStatusConstants.Created) { throw new Exception("MC:0x00000084");///已创建状态才可进行修改 } string newLocation = CommonBLL.GetFieldValue(fields, "NEW_LOCATION"); string oldLocation = CommonBLL.GetFieldValue(fields, "OLD_LOCATION"); if ((string.IsNullOrEmpty(newLocation) && !string.IsNullOrEmpty(oldLocation)) || (!string.IsNullOrEmpty(newLocation) && string.IsNullOrEmpty(oldLocation))) { throw new Exception("MC:0x00000491");///新旧工位必须同时填写或者同时不填 } string newPartQty = CommonBLL.GetFieldValue(fields, "NEW_PART_QTY"); string oldPartQty = CommonBLL.GetFieldValue(fields, "OLD_PART_QTY"); if ((newPartQty != "null" && oldPartQty == "null") || (newPartQty == "null" && oldPartQty != "null")) { throw new Exception("MC:0x00000492");///新旧物料用量必须同时填写或者同时不填 } string newPartNo = CommonBLL.GetFieldValue(fields, "NEW_PART_NO"); string oldPartNo = CommonBLL.GetFieldValue(fields, "OLD_PART_NO"); if ((string.IsNullOrEmpty(newPartNo) && !string.IsNullOrEmpty(oldPartNo)) || (!string.IsNullOrEmpty(newPartNo) && string.IsNullOrEmpty(oldPartNo))) { throw new Exception("MC:0x00000493");///新旧物料号必须同时填写或者同时不填 } string newSupplierNum = CommonBLL.GetFieldValue(fields, "NEW_SUPPLIER_NUM"); string oldSupplierNum = CommonBLL.GetFieldValue(fields, "OLD_SUPPLIER_NUM"); if ((string.IsNullOrEmpty(newSupplierNum) && !string.IsNullOrEmpty(oldSupplierNum)) || (!string.IsNullOrEmpty(newSupplierNum) && string.IsNullOrEmpty(oldSupplierNum))) { throw new Exception("MC:0x00000494");///新旧供应商必须同时填写或者同时不填 } return(dal.UpdateInfo(fields, id) > 0 ? true : false); }
/// <summary> /// UpdateInfo /// </summary> /// <param name="fields">更新字段</param> /// <returns></returns> public bool UpdateInfo(string fields, long id) { JisPartBoxInfo info = dal.GetInfo(id); if (info == null) { throw new Exception("MC:0x00000084");///数据错误 } if (info.Status != (int)BasicDataStatusConstants.Created) { throw new Exception("MC:0x00000441");///已创建状态才可进行修改 } string partBoxName = CommonBLL.GetFieldValue(fields, "PART_BOX_NAME"); int partBoxNameCnt = dal.GetCounts(" [PART_BOX_NAME] = N'" + partBoxName + "' and [ID] <> " + id + ""); if (partBoxNameCnt > 0) { throw new Exception("Err_:MC:0x00000303");///零件类名称重复 } return(dal.UpdateInfo(fields, id) > 0 ? true : false); }
/// <summary> /// /// </summary> /// <param name="fields"></param> /// <param name="id"></param> /// <returns></returns> public bool UpdateInfo(string fields, long id) { ///工段名称④在同一生产线代码下不允许重复 string workshopSectionName = CommonBLL.GetFieldValue(fields, "WORKSHOP_SECTION_NAME"); string assemblyLine = CommonBLL.GetFieldValue(fields, "ASSEMBLY_LINE"); if (string.IsNullOrEmpty(workshopSectionName)) { throw new Exception("MC:0x00000104");///工段名称不能为空 } if (string.IsNullOrEmpty(assemblyLine)) { throw new Exception("MC:0x00000105");///生产线代码不能为空 } int cnt = dal.GetCounts("[ID] <> " + id + " and [WORKSHOP_SECTION_NAME] = N'" + workshopSectionName + "' and [ASSEMBLY_LINE] = N'" + assemblyLine + "'"); if (cnt > 0) { throw new Exception("Err_:MC:0x00000171"); } return(dal.UpdateInfo(fields, id) > 0 ? true : false); }
/// <summary> /// /// </summary> /// <param name="fields"></param> /// <param name="id"></param> /// <returns></returns> public bool UpdateInfo(string fields, long id) { int cnt = dal.GetCounts("[ID] = " + id + " and [STATUS] = " + (int)BasicDataStatusConstants.Disabled + ""); if (cnt > 0) { throw new Exception("MC:0x00000742");///已作废的零件类不能进行修改 } ///来源存储区⑧与目标存储区⑩不能为同一存储区 string sourceZoneNo = CommonBLL.GetFieldValue(fields, "SOURCE_ZONE_NO"); string targetZoneNo = CommonBLL.GetFieldValue(fields, "TARGET_ZONE_NO"); if (sourceZoneNo == targetZoneNo) { throw new Exception("MC:0x00000402");///来源存储区与目标存储区不可一致,请重新选取 } string partBoxCode = CommonBLL.GetFieldValue(fields, "PART_BOX_CODE"); string plant = CommonBLL.GetFieldValue(fields, "PLANT"); string workshop = CommonBLL.GetFieldValue(fields, "WORKSHOP"); string assemblyLine = CommonBLL.GetFieldValue(fields, "ASSEMBLY_LINE"); PartsBoxInfo partsBoxInfo = new PartsBoxInfo(); partsBoxInfo.PullMode = (int)PullModeConstants.Plan; partsBoxInfo.BoxParts = partBoxCode; partsBoxInfo.Plant = plant; partsBoxInfo.Workshop = workshop; partsBoxInfo.AssemblyLine = assemblyLine; using (var trans = new TransactionScope()) { new MaintainInhouseLogisticStandardDAL().UpdatePartsBoxInfo(partsBoxInfo); if (dal.UpdateInfo(fields, id) == 0) { return(false); } trans.Complete(); } return(true); }
/// <summary> /// 修改 /// </summary> /// <param name="fields"></param> /// <param name="id"></param> /// <returns></returns> public bool UpdateInfo(string fields, long id) { ///状态⑫为10.已创建的入库单可以进行修改 VmiReceiveInfo info = dal.GetInfo(id); if (info.Status != (int)WmmOrderStatusConstants.Created) { throw new Exception("MC:0x00000683");///状态必须为已创建 } ///供应商,对于VMI来说明细中的供应商就是单据的供应商 StringBuilder @string = new StringBuilder(); string supplierNum = CommonBLL.GetFieldValue(fields, "SUPPLIER_NUM"); string loginUser = CommonBLL.GetFieldValue(fields, "MODIFY_USER"); if (!string.IsNullOrEmpty(supplierNum) && info.SupplierNum != supplierNum) { @string.AppendLine("" + "update [LES].[TT_WMM_VMI_RECEIVE_DETAIL] set " + "[SUPPLIER_NUM] = N'" + supplierNum + "'," + "[MODIFY_DATE] = GETDATE()," + "[MODIFY_USER] = N'" + loginUser + "' " + "where [RECEIVE_FID] = N'" + info.Fid.GetValueOrDefault() + "';"); } ///执行 using (var trans = new TransactionScope()) { if (dal.UpdateInfo(fields, id) == 0) { return(false); } if (@string.Length > 0) { CommonDAL.ExecuteNonQueryBySql(@string.ToString()); } trans.Complete(); } return(true); }