| | |
| | | //å建WebSocketè¿æ¥ |
| | | //"ws://127.0.0.1:9295/admin" |
| | | //client = new WebSocket("ws://192.168.0.250:9260/"); |
| | | client = new WebSocket("ws:localhost:9260/"); |
| | | client = new WebSocket("ws:10.30.4.92:9260/"); |
| | | client.onopen = function() { |
| | | //client.onmessage = handleMessage; |
| | | // store.commit("setWebsocket", client); |
| | |
| | | MesOutbound = 200, |
| | | |
| | | /// <summary> |
| | | /// MES大å·PPåºåº |
| | | /// </summary> |
| | | [Description("MES大å·PPåºåº")] |
| | | MesPPOutbound = 205, |
| | | /// <summary> |
| | | /// MESæå¨åºåº |
| | | /// </summary> |
| | | [Description("MESæå¨åºåº")] |
| | | MesHandOutbound = 210, |
| | | |
| | | /// <summary> |
| | | /// MESå°å·PPåºåº |
| | | /// </summary> |
| | | [Description("MESå°å·PPåºåº")] |
| | | MesPPCutOutbound = 215, |
| | | |
| | | /// <summary> |
| | | /// MESæå¨æ£éåºåº |
| | |
| | | /// </summary> |
| | | [Description("é²çå°çº¿è¾¹å¤§ä»¶")] |
| | | MaskOutLarge = 275, |
| | | |
| | | /// <summary> |
| | | /// PPæ¬è¿è³çº¿è¾¹ |
| | | /// </summary> |
| | | [Description("PPæ¬è¿è³çº¿è¾¹")] |
| | | MesPPMove = 280, |
| | | /// <summary> |
| | | /// éè´å
¥åº |
| | | /// </summary> |
| | |
| | | MesPalletSmallReturn = 585, |
| | | |
| | | /// <summary> |
| | | /// PPå
¥å¹³åº |
| | | /// </summary> |
| | | [Description("PPå
¥å¹³åº")] |
| | | PPPKInbound = 590, |
| | | |
| | | /// <summary> |
| | | /// 空箱å
¥åº |
| | | /// </summary> |
| | | [Description("空箱å
¥åº")] |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using Microsoft.AspNetCore.Authorization; |
| | | using Microsoft.AspNetCore.Http; |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using WIDESEA_DTO.Agv; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_Core.Enums; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_IBasicInfoRepository; |
| | | using WIDESEAWCS_ITaskInfoRepository; |
| | | using WIDESEAWCS_ITaskInfoService; |
| | | using WIDESEAWCS_Model.Models; |
| | | using WIDESEAWCS_QuartzJob; |
| | | using WIDESEAWCS_Tasks; |
| | | |
| | | namespace WIDESEAWCS_Server.Controllers |
| | | { |
| | | [Route("api/[controller]")] |
| | | [ApiController] |
| | | public class PP_AGVController : ControllerBase |
| | | { |
| | | private readonly IStationMangerRepository _stationMangerRepository; |
| | | private readonly ITaskService _taskService; |
| | | private readonly ITaskRepository _taskRepository; |
| | | |
| | | public PP_AGVController(IStationMangerRepository stationMangerRepository, ITaskService taskService, ITaskRepository taskRepository) |
| | | { |
| | | _stationMangerRepository = stationMangerRepository; |
| | | _taskService = taskService; |
| | | _taskRepository = taskRepository; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// AGV任塿´æ°/宿 |
| | | /// </summary> |
| | | /// <param name="agvUpdateModel"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, HttpGet, Route("AgvCallback"), AllowAnonymous] |
| | | public AgvResponseContent AgvUpdateTask([FromBody] AgvUpdateDTO agvUpdateModel) |
| | | { |
| | | AgvResponseContent agvResponseContent = new AgvResponseContent(); |
| | | try |
| | | { |
| | | if (agvUpdateModel == null) throw new Exception("æªè·åå°è¯·æ±åæ°"); |
| | | agvResponseContent.ReqCode = agvUpdateModel.ReqCode; |
| | | var task = _taskRepository.QueryFirst(x => agvUpdateModel.TaskCode == x.AgvTaskNum); |
| | | if (task == null && agvUpdateModel.Method != "begin") throw new Exception($"æªæ¾å°ä»»å¡,ä»»å¡å·ã{agvUpdateModel.TaskCode}ã"); |
| | | switch (agvUpdateModel.Method) |
| | | { |
| | | case "start": |
| | | break; |
| | | case "begin": |
| | | break; |
| | | case "outbin"://åºåºæ ¹æ®è¿ä¸ªä¿¡å·å¤æåè´§å®æ |
| | | if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | { |
| | | task.TaskState = TaskStatusEnum.AGV_Finish.ObjToInt(); |
| | | var up = _taskRepository.DeleteAndMoveIntoHty(task, OperateTypeEnum.èªå¨å®æ); |
| | | _taskService.TaskCompleted(task.TaskNum); |
| | | agvResponseContent.Code = up ? "0" : "1"; |
| | | agvResponseContent.Message = up ? "æå" : "失败"; |
| | | return agvResponseContent; |
| | | } |
| | | break; |
| | | case "getSafetySignal"://å®å
¨ä¿¡å·ç³è¯· |
| | | { |
| | | break; |
| | | } |
| | | case "end"://å
¥åºæ ¹æ®è¿ä¸ªä¿¡å·å¤ææ¾è´§å®æ |
| | | if (task.TaskType != TaskTypeEnum.Outbound.ObjToInt()) |
| | | { |
| | | task.TaskState = TaskStatusEnum.AGV_Finish.ObjToInt(); |
| | | var up = _taskRepository.DeleteAndMoveIntoHty(task, OperateTypeEnum.èªå¨å®æ); |
| | | _taskService.TaskCompleted(task.TaskNum); |
| | | agvResponseContent.Code = up ? "0" : "1"; |
| | | agvResponseContent.Message = up ? "æå" : "失败"; |
| | | return agvResponseContent; |
| | | } |
| | | break; |
| | | case "cancel": |
| | | task.TaskState = TaskStatusEnum.Cancel.ObjToInt(); |
| | | _taskRepository.UpdateData(task); |
| | | break; |
| | | default: |
| | | throw new Exception($"æªå®ä¹æ¹æ³åã{agvUpdateModel.Method}ã"); |
| | | } |
| | | agvResponseContent.Code = "0"; |
| | | agvResponseContent.Message = "æå"; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | agvResponseContent.Code = "1"; |
| | | agvResponseContent.Message = ex.Message; |
| | | } |
| | | return agvResponseContent; |
| | | //return _taskService.AgvUpdateTask(agvUpdateModel); |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | |
| | | if (taskTypeGroup == TaskTypeGroup.OutbondGroup) |
| | | { |
| | | task.AgvTaskNum = item.AGVArea + DateTime.Now.ToString("yyMMdd") + item.TaskNum; |
| | | if(item.AGVArea == "AGV_PP") |
| | | { |
| | | task.NextAddress = item.TargetAddress; |
| | | task.DeviceCode = item.RoadWay; |
| | | } |
| | | else |
| | | { |
| | | List<Dt_Router> routers = routersAll.Where(x => x.InOutType == item.TaskType && item.AGVArea == x.NextPosi).ToList(); |
| | | if (routers.FirstOrDefault() == null) |
| | | { |
| | |
| | | { |
| | | task.TaskState = TaskStatusEnum.SC_Execute.ObjToInt(); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (item.AGVArea == "AGV_PP") |
| | | { |
| | | task.AgvTaskNum = item.AGVArea + DateTime.Now.ToString("yyMMdd") + item.TaskNum; |
| | | task.NextAddress = item.TargetAddress; |
| | | task.DeviceCode = item.RoadWay; |
| | | } |
| | | else |
| | | { |
| | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | tasks.Add(task); |
| | | } |
| | |
| | | try |
| | | { |
| | | var newTasks = _taskService.Db.Queryable<Dt_Task>().Where(x => (x.TaskState == TaskStatusEnum.New.ObjToInt()||x.TaskState==TaskStatusEnum.AGV_Execute.ObjToInt()) && nameof(AGV_PPJob).Contains(x.DeviceCode) && !string.IsNullOrEmpty(x.DeviceCode)).ToList().OrderBy(x => x.Grade).ThenBy(x => x.CreateDate).ToList(); |
| | | foreach (var task in newTasks) |
| | | foreach (var agvTask in newTasks) |
| | | { |
| | | try |
| | | { |
| | | AgvTaskDTO TaskDTO = new AgvTaskDTO() |
| | | string taskTyp; |
| | | if (agvTask.TaskType == TaskTypeEnum.MesPPMove.ObjToInt()) |
| | | { |
| | | TaskCode = task.AgvTaskNum, |
| | | ReqCode = DateTime.Now.ToString("yyMMddHHmmss") + task.AgvTaskNum, |
| | | TaskTyp = task.TaskType < TaskTypeEnum.Inbound.ObjToInt() ? "FLC" : "FLR", |
| | | ctnrCode = task.PalletCode, |
| | | taskTyp = "110"; |
| | | } |
| | | else if (agvTask.PalletType < 2) |
| | | { |
| | | taskTyp = "008"; |
| | | } |
| | | else |
| | | { |
| | | taskTyp = "004"; |
| | | } |
| | | |
| | | AgvTaskDTO taskDTO = new AgvTaskDTO() |
| | | { |
| | | ReqCode = Guid.NewGuid().ToString().Replace("-", ""), |
| | | TaskTyp = taskTyp, |
| | | PositionCodePath = new List<CodePath>() |
| | | { |
| | | new CodePath() |
| | | { |
| | | type="00", |
| | | positionCode=task.CurrentAddress |
| | | positionCode = agvTask.CurrentAddress |
| | | }, |
| | | new CodePath() |
| | | { |
| | | type="00", |
| | | positionCode=task.NextAddress |
| | | type = (agvTask.TaskType == TaskTypeEnum.PPPKInbound.ObjToInt()||agvTask.TaskType == TaskTypeEnum.MesPPCutOutbound.ObjToInt()) ? "00" : "04", |
| | | positionCode = agvTask.NextAddress |
| | | } |
| | | }, |
| | | TaskCode = agvTask.AgvTaskNum, |
| | | }; |
| | | WebResponseContent content = _taskService.AgvSendTask(TaskDTO, APIEnum.Agv_PPSendTask); |
| | | if (!content.Status) throw new Exception(content.Message); |
| | | task.TaskState = TaskStatusEnum.AGV_Executing.ObjToInt(); |
| | | WebResponseContent content = _taskService.AgvSendTask(taskDTO); |
| | | if (content.Status) |
| | | { |
| | | agvTask.TaskState = TaskStatusEnum.AGV_Executing.ObjToInt(); |
| | | //agvTask.Remark = content.Data.ObjToString(); |
| | | _taskService.UpdateTask(agvTask, TaskStatusEnum.AGV_Executing); |
| | | } |
| | | else |
| | | { |
| | | agvTask.TaskState = TaskStatusEnum.Exception.ObjToInt(); |
| | | //agvTask.Remark = content.Data.ObjToString(); |
| | | agvTask.ExceptionMessage = content.Message; |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | task.TaskState = TaskStatusEnum.Exception.ObjToInt(); |
| | | task.ExceptionMessage = ex.Message; |
| | | agvTask.TaskState = TaskStatusEnum.Exception.ObjToInt(); |
| | | //agvTask.Remark = content.Data.ObjToString(); |
| | | agvTask.ExceptionMessage = ex.Message; |
| | | WriteError(nameof(AGV_PPJob), ex.Message, ex); |
| | | } |
| | | } |
| | | _taskService.UpdateData(newTasks); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | WriteError(nameof(AGV_FLJob), ex.Message, ex); |
| | | WriteError(nameof(AGV_PPJob), ex.Message, ex); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | WriteError(nameof(AGV_FLJob), ex.Message, ex); |
| | | WriteError(nameof(AGV_ZHJob), ex.Message, ex); |
| | | } |
| | | } |
| | | /// <summary> |
| | |
| | | :padding="15" |
| | | title="æå°" |
| | | > |
| | | <div |
| | | id="printContent" |
| | | style="display: flex; justify-content: center; align-items: center" |
| | | > |
| | | <div |
| | | style="display: flex; justify-content: center; align-items: center" |
| | | > |
| | | <div id="printContent" style="display: flex; justify-content: center; align-items: center"> |
| | | <div style="display: flex; justify-content: center; align-items: center"> |
| | | <VueQrcode id="qrcode" :value="Code" :size="200"></VueQrcode> |
| | | </div> |
| | | </div> |
| | | <div id="palletcode"> |
| | | <!-- <span |
| | | style="display: flex; justify-content: center; align-items: center" |
| | | >{{ Code }}</span |
| | | > --> |
| | | <span |
| | | style="display: flex; justify-content: center; align-items: center" |
| | | <span style="display: flex; justify-content: center; align-items: center" |
| | | >ç©æç¼ç :{{ materielCode }}</span |
| | | > |
| | | <!-- decimalæå¼ææ¾ç¤ºç©æé¿åº¦ï¼æ å¼åéè --> |
| | | <span |
| | | v-if="isHasMaterielLength" |
| | | style="display: flex; justify-content: center; align-items: center; margin-top: 8px" |
| | | >ç©æé¿åº¦:{{ materielLength }}</span |
| | | > |
| | | </div> |
| | | |
| | | <template #footer> |
| | | <el-button type="primary" size="small" @click="print()">æå°</el-button> |
| | | <el-button type="danger" size="small" @click="showDetialBox = false" |
| | | >å
³é</el-button |
| | | > |
| | | <el-button type="danger" size="small" @click="showDetialBox = false">å
³é</el-button> |
| | | </template> |
| | | </vol-box> |
| | | </div> |
| | |
| | | import VolBox from "@/components/basic/VolBox.vue"; |
| | | import VueQrcode from "vue-qrcode"; |
| | | import QRCode from "qrcode"; |
| | | import { da } from "element-plus/es/locales.mjs"; |
| | | export default { |
| | | components: { VolBox, VueQrcode }, |
| | | data() { |
| | |
| | | quantity: "", |
| | | productionDate: "", |
| | | effectiveDate: "", |
| | | materielLength: null, // decimalç±»ååå§å为nullï¼å¹é
å端æ°å¼ç±»å |
| | | }; |
| | | }, |
| | | computed: { |
| | | // 计ç®å±æ§ï¼ç»ä¸å¤ææ¯å¦æç©æé¿åº¦ï¼decimalææææ°å¼ï¼ï¼æ¨¡æ¿åé»è¾å¤ç¨ |
| | | isHasMaterielLength() { |
| | | return this.materielLength !== null && this.materielLength !== undefined&& this.materielLength !== 0; |
| | | }, |
| | | }, |
| | | methods: { |
| | | open(row) { |
| | | this.row = row; |
| | | this.showDetialBox = true; |
| | | // æ¯æ¬¡æå¼éç½®ææå¼ï¼é¿å
ç¼å |
| | | this.resetForm(); |
| | | if (row && row.materielCode) { |
| | | this.materielCode = row.materielCode; |
| | | this.lotNo = row.lotNo; |
| | | this.purchaseOrderNo = row.purchaseOrderNo; |
| | | this.quantity = row.quantity; |
| | | // èµå¼åºç¡å段 |
| | | this.materielCode = row.materielCode || ""; |
| | | this.lotNo = row.lotNo || ""; |
| | | this.purchaseOrderNo = row.purchaseOrderNo || ""; |
| | | this.quantity = row.quantity || ""; |
| | | this.productionDate = formatDate(row.productionDate); |
| | | this.effectiveDate = formatDate(row.effectiveDate); |
| | | // èµå¼decimalç±»åç©æé¿åº¦ï¼ç´æ¥åå端å¼ï¼null/undefined/æ°å¼é½å
¼å®¹ï¼ |
| | | this.materielLength = row.materielLength; |
| | | } |
| | | this.Code = |
| | | "M:" + |
| | | this.materielCode + |
| | | ",BS:" + |
| | | this.lotNo + |
| | | ",DM:" + |
| | | this.productionDate + |
| | | ",DE:" + |
| | | this.effectiveDate + |
| | | ",Q:" + |
| | | this.quantity + |
| | | ",PO:" + |
| | | this.purchaseOrderNo; |
| | | // æ ¸å¿ï¼æ¼æ¥äºç»´ç Codeï¼æ é¿åº¦åå®å
¨ä¸åºç°,ML |
| | | this.Code = this.spliceQrCode(); |
| | | }, |
| | | // æ½ç¦»äºç»´ç æ¼æ¥é»è¾ï¼ä»£ç æ´æ¸
æ° |
| | | spliceQrCode() { |
| | | // åºç¡åºå®æ¼æ¥é¨å |
| | | let baseStr = [ |
| | | `M:${this.materielCode}`, |
| | | `BS:${this.lotNo}`, |
| | | `DM:${this.productionDate}`, |
| | | `DE:${this.effectiveDate}`, |
| | | `Q:${this.quantity}`, |
| | | `PO:${this.purchaseOrderNo}`, |
| | | ].join(","); |
| | | // ä»
å½æç©æé¿åº¦æ¶ï¼è¿½å ,ML:æ°å¼ï¼æ å¼åç´æ¥è¿ååºç¡ä¸² |
| | | if (this.isHasMaterielLength) { |
| | | baseStr += `,ML:${this.materielLength}`; |
| | | } |
| | | return baseStr; |
| | | }, |
| | | print() { |
| | | let printContent = document.getElementById("printContent"); |
| | | let palletcode = document.getElementById("palletcode"); |
| | | var printWindow = window.open("", ""); |
| | | printWindow.document.write(printContent.innerHTML); |
| | | printWindow.document.write(palletcode.innerHTML); |
| | | const printContent = document.getElementById("printContent"); |
| | | const palletcode = document.getElementById("palletcode"); |
| | | const printWindow = window.open("", ""); |
| | | // å®åæå°é¡µé¢ç»æï¼é¿å
æ ·å¼éä¹± |
| | | printWindow.document.write(` |
| | | <html> |
| | | <head><meta charset="utf-8"><title>æå°</title></head> |
| | | <body style="text-align: center; padding: 20px;"> |
| | | ${printContent.innerHTML} |
| | | ${palletcode.innerHTML} |
| | | </body> |
| | | </html> |
| | | `); |
| | | printWindow.document.close(); |
| | | printWindow.focus(); |
| | | printWindow.print(); |
| | | printWindow.close(); |
| | | }, |
| | | formatDate(dateStr) { |
| | | let date = new Date(dateStr); |
| | | let year = date.getFullYear(); |
| | | let month = String(date.getMonth() + 1).padStart(2, "0"); |
| | | let day = String(date.getDate()).padStart(2, "0"); |
| | | return year + "-" + month + "-" + day; |
| | | // é置表åï¼é¿å
夿¬¡æå¼å¼¹çªç¼åä¸ä¸æ¬¡æ°æ® |
| | | resetForm() { |
| | | this.materielCode = ""; |
| | | this.lotNo = ""; |
| | | this.purchaseOrderNo = ""; |
| | | this.quantity = ""; |
| | | this.productionDate = ""; |
| | | this.effectiveDate = ""; |
| | | this.materielLength = null; |
| | | this.Code = ""; |
| | | }, |
| | | }, |
| | | |
| | | created() {}, |
| | | }; |
| | | // æ¥ææ ¼å¼åå·¥å
·å½æ°ï¼å 空å¼å¤æé¿å
æ¥é |
| | | function formatDate(dateStr) { |
| | | if (!dateStr) return ""; |
| | | const date = new Date(dateStr); |
| | | return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart( |
| | | 2, |
| | | "0" |
| | | )}-${String(date.getDate()).padStart(2, "0")}`; |
| | | return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, "0")}-${String(date.getDate()).padStart(2, "0")}`; |
| | | } |
| | | </script> |
| | | |
| | |
| | | .el-col { |
| | | border-radius: 4px; |
| | | } |
| | | |
| | | .grid-content { |
| | | border-radius: 4px; |
| | | min-height: 36px; |
| | | } |
| | | |
| | | .content-text { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | } |
| | | |
| | | .right-text { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: flex-end; |
| | | } |
| | | </style> |
| | | |
| | | <style> |
| | | .el-table .warning-row { |
| | | background: #e6a23c; |
| | | } |
| | | |
| | | .el-table .success-row { |
| | | background: #f0f9eb; |
| | | } |
| | | |
| | | .el-table .error-row { |
| | | background: #f56c6c; |
| | | } |
| | | |
| | | canvas { |
| | | display: block; |
| | | margin: auto; |
| | | } |
| | | /* æå°æ ·å¼ä¼åï¼éé
æå°æº */ |
| | | @media print { |
| | | body { |
| | | margin: 0; |
| | | padding: 0; |
| | | } |
| | | } |
| | | </style> |
| | |
| | | hidden: true, |
| | | }, |
| | | { |
| | | prop: "materielCode", |
| | | prop: "materialCode", |
| | | title: "ç©æç¼å·", |
| | | type: "string", |
| | | width: 150, |
| | | }, |
| | | { |
| | | prop: "materielName", |
| | | prop: "materialName", |
| | | title: "ç©æåç§°", |
| | | type: "string", |
| | | width: 150, |
| | | }, |
| | | { |
| | | field: "targetAddressCode", |
| | | prop: "targetAddressCode", |
| | | title: "线边ä»å°åç ", |
| | | type: "string", |
| | | width: 100, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "width", |
| | | prop: "width", |
| | | title: "è£å宽", |
| | | type: "string", |
| | | width: 100, |
| | | align: "left", |
| | | }, |
| | | { |
| | | prop: "orderQuantity", |
| | |
| | | components: { |
| | | //æ¥è¯¢ç颿©å±ç»ä»¶ |
| | | gridHeader: '', |
| | | gridBody: gridBody, |
| | | gridBody: '', |
| | | gridFooter: '', |
| | | //æ°å»ºãç¼è¾å¼¹åºæ¡æ©å±ç»ä»¶ |
| | | modelHeader: '', |
| | |
| | | //ä¸é¢è¿äºæ¹æ³å¯ä»¥ä¿çä¹å¯ä»¥å é¤ |
| | | onInit() { |
| | | //æ©å±é¡µé¢åå§åæä½ |
| | | this.columns.push({ |
| | | field: 'æä½', |
| | | title: 'æä½', |
| | | width: 90, |
| | | fixed: 'right', |
| | | align: 'center', |
| | | formatter: (row) => { |
| | | return ( |
| | | '<i style="cursor: pointer;color: #2d8cf0;"class="el-icon-view">æ¥çæç»</i>' |
| | | ); |
| | | }, |
| | | click: (row) => { |
| | | this.$refs.gridBody.open(row); |
| | | } |
| | | }); |
| | | |
| | | }, |
| | | onInited() { |
| | | //æ¡æ¶åå§åé
ç½®å |
| | |
| | | components: { |
| | | //æ¥è¯¢ç颿©å±ç»ä»¶ |
| | | gridHeader: '', |
| | | gridBody: gridBody, |
| | | gridBody: '', |
| | | gridFooter: '', |
| | | //æ°å»ºãç¼è¾å¼¹åºæ¡æ©å±ç»ä»¶ |
| | | modelHeader: '', |
| | |
| | | //ä¸é¢è¿äºæ¹æ³å¯ä»¥ä¿çä¹å¯ä»¥å é¤ |
| | | onInit() { |
| | | //æ©å±é¡µé¢åå§åæä½ |
| | | this.columns.push({ |
| | | field: 'æä½', |
| | | title: 'æä½', |
| | | width: 90, |
| | | fixed: 'right', |
| | | align: 'center', |
| | | formatter: (row) => { |
| | | return ( |
| | | '<i style="cursor: pointer;color: #2d8cf0;"class="el-icon-view">æ¥çæç»</i>' |
| | | ); |
| | | }, |
| | | click: (row) => { |
| | | this.$refs.gridBody.open(row); |
| | | } |
| | | }); |
| | | |
| | | }, |
| | | onInited() { |
| | | //æ¡æ¶åå§åé
ç½®å |
| | |
| | | locationType: "", |
| | | enableStatus: "", |
| | | locationStatus: "", |
| | | row: "", |
| | | column: "", |
| | | layer: "", |
| | | }); |
| | | const searchFormOptions = ref([ |
| | | [ |
| | |
| | | { |
| | | field: "column", |
| | | title: "è´§ä½å", |
| | | type: "int", |
| | | type: "string", |
| | | width: 120, |
| | | align: "left", |
| | | hidden: true, |
| | |
| | | [ |
| | | { title: "éè´åå·", field: "purchaseOrderNo", type: "like" }, |
| | | { title: "ç©æç¼å·", field: "materielCode", type: "like" }, |
| | | {title: "æå±ä»åº", field:"warehouseId",type:"select",dataKey:"warehouses",data:[]}, |
| | | { title: "æ¹æ¬¡å·", field: "lotNo", type: "like" }, |
| | | ], |
| | | ]); |
| | | const columns = ref([ |
| | |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "materielLength", |
| | | title: "ç©æé¿åº¦", |
| | | type: "int", |
| | | width: 80, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "productionDate", |
| | | title: "çäº§æ¥æ", |
| | | type: "date", |
| | |
| | | const searchFormOptions = ref([ |
| | | [ |
| | | { title: "åæ®ç¼å·", field: "orderNo", type: "like" }, |
| | | { title: "䏿¸¸åæ®ç¼å·", field: "taskNo", type: "like" }, |
| | | { |
| | | title: "åæ®ç±»å", |
| | | field: "orderType", |
| | |
| | | { |
| | | field: "orderNo", |
| | | title: "åæ®ç¼å·", |
| | | type: "string", |
| | | width: 160, |
| | | align: "left", |
| | | // link: true |
| | | }, |
| | | { |
| | | field: "taskNo", |
| | | title: "䏿¸¸åæ®ç¼å·", |
| | | type: "string", |
| | | width: 160, |
| | | align: "left", |
| | |
| | | hidden: true, |
| | | }, |
| | | { |
| | | field: "materielCode", |
| | | field: "materialCode", |
| | | title: "ç©æç¼å·", |
| | | type: "string", |
| | | width: 150, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "materielName", |
| | | field: "materialName", |
| | | title: "ç©æåç§°", |
| | | type: "string", |
| | | width: 150, |
| | |
| | | sortName: "id", |
| | | }); |
| | | const editFormFields = ref({ |
| | | deviceCode: "", |
| | | deviceName: "", |
| | | deviceType: "", |
| | | deviceStatus: "", |
| | | deviceIp: "", |
| | | devicePort: "", |
| | | devicePlcType: "", |
| | | deviceRemark: "", |
| | | |
| | | }); |
| | | const editFormOptions = ref([ |
| | | [ |
| | |
| | | type: "string", |
| | | }, |
| | | ], |
| | | [ |
| | | { title: "设å¤IP", required: true, field: "deviceIp", type: "string" }, |
| | | { |
| | | title: "设å¤ç«¯å£", |
| | | required: true, |
| | | field: "devicePort", |
| | | type: "string", |
| | | }, |
| | | { |
| | | title: "PLCç±»å", |
| | | required: true, |
| | | field: "devicePlcType", |
| | | type: "string", |
| | | }, |
| | | { |
| | | title: "夿³¨", |
| | | field: "deviceRemark", |
| | | type: "string", |
| | | }, |
| | | ], |
| | | |
| | | ]); |
| | | const searchFormFields = ref({ |
| | | deviceCode: "", |
| | | deviceType: "", |
| | | deviceStatus: "", |
| | | |
| | | }); |
| | | const searchFormOptions = ref([ |
| | | [ |
| | | { title: "设å¤ç¼å·", field: "deviceCode" }, |
| | | { title: "设å¤ç±»å", field: "deviceType" }, |
| | | { title: "设å¤ç¶æ", field: "deviceStatus" }, |
| | | { title: "ç©æåç§°", field: "materialName", type: "like" }, |
| | | { title: "ç©æç¼å·", field: "materialCode", type: "like" }, |
| | | { title: "æ¹æ¬¡å·", field: "batchNo", type: "like" }, |
| | | { |
| | | title: "åæ®æç»ç¶æ", |
| | | field: "orderDetailStatus", |
| | | type: "select", |
| | | dataKey: "orderDetailStatusEnum", |
| | | data: [], |
| | | }, |
| | | ], |
| | | ]); |
| | | const columns = ref([ |
| | |
| | | hidden: true, |
| | | }, |
| | | { |
| | | field: "materielCode", |
| | | field: "materialCode", |
| | | title: "ç©æç¼å·", |
| | | type: "string", |
| | | width: 150, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "materielName", |
| | | field: "materialName", |
| | | title: "ç©æåç§°", |
| | | type: "string", |
| | | width: 150, |
| | |
| | | { |
| | | field: "orderDetailStatus", |
| | | title: "订åæç»ç¶æ", |
| | | type: "string", |
| | | type: "select", |
| | | width: 180, |
| | | align: "left", |
| | | bind: { key: "orderDetailStatusEnum", data: [] }, |
| | | }, |
| | | { |
| | | field: "LayerCode", |
| | |
| | | }, |
| | | ]); |
| | | const detail = ref({ |
| | | cnName: "#detailCnName", |
| | | cnName: "MESåºåºåæç»", |
| | | table: "", |
| | | columns: [], |
| | | sortName: "", |
| | |
| | | const searchFormOptions = ref([ |
| | | [ |
| | | { title: "åæ®ç¼å·", field: "orderNo", type: "like" }, |
| | | { title: "ä»»å¡åå·", field: "taskNo", type: "like" }, |
| | | { title: "ç©æç¼å·", field: "materialCode", type: "like" }, |
| | | { title: "æ¹æ¬¡å·", field: "batchNo", type: "like" }, |
| | | ], |
| | | [ |
| | | { |
| | | title: "åæ®ç¶æ", |
| | | field: "orderStatus", |
| | | type: "select", |
| | | dataKey: "orderDetailStatusEnum", |
| | | data: [], |
| | | }, |
| | | ], |
| | | ]); |
| | | const columns = ref([ |
| | |
| | | type: "decimal", |
| | | width: 90, |
| | | align: "left", |
| | | bind: { key: "outboundStatusEnum", data: [] }, |
| | | bind: { key: "orderDetailStatusEnum", data: [] }, |
| | | }, |
| | | { |
| | | field: "materialCode", |
| | |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Common.LocationEnum; |
| | | using WIDESEA_Common.WareHouseEnum; |
| | | using WIDESEA_Core.BaseRepository; |
| | | using WIDESEA_Core.Enums; |
| | | using WIDESEA_Core.Helper; |
| | |
| | | { |
| | | return QueryData(x => x.LocationCode, x => x.WarehouseId == warehouseId && x.LocationStatus == LocationStatusEnum.InStock.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyOut.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt())).Distinct().ToList(); |
| | | } |
| | | /// <summary> |
| | | /// PP大å·åºåºï¼å¹³åºä¼å
ï¼ç«åºè¡¥å¿åºåºçè´§ä½ç¼å·éå |
| | | /// </summary> |
| | | /// <param name="warehouseId"></param> |
| | | /// <returns></returns> |
| | | public List<string> GetCanOutPPLocationCodes(int warehouseId) |
| | | { |
| | | //æ¥å¹³åºè´§ä½ |
| | | Dt_Warehouse warehouse = Db.Queryable<Dt_Warehouse>().Where(x => x.WarehouseCode == WarehouseEnum.HA581.ToString()).First(); |
| | | return QueryData(x => x.LocationCode, x => (x.WarehouseId == warehouseId || x.WarehouseId == warehouse.WarehouseId) && x.LocationStatus == LocationStatusEnum.InStock.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyOut.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt())).Distinct().ToList(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// è·åå¯åºåºè´§ä½ç¼å· |
| | |
| | | "HA153" => AssignLocation(roadwayNo), |
| | | "HA71" or "HA72" or "HA73" => AssignLocation(roadwayNo), |
| | | "HA60" => AssignLocation(roadwayNo), |
| | | "HA581" => AssignLocation_PPPK(roadwayNo,palletTypeInfo.PalletType), |
| | | _ => throw new Exception($"æªæ¾å°ä»åºè´§ä½åé
æ¹æ³") |
| | | }; |
| | | } |
| | |
| | | } |
| | | return groupLocations; |
| | | } |
| | | |
| | | |
| | | public Dt_LocationInfo? AssignLocation_PPPK(string roadwayNo, int palletType) |
| | | { |
| | | lock (_locker) |
| | | { |
| | | List<LocationCache> removeItems = locationCaches.Where(x => (DateTime.Now - x.DateTime).TotalMinutes > 5).ToList();//æ¥è¯¢æ·»å éæåéè¶
è¿5åéçè´§ä½ |
| | | int count = removeItems.Count; |
| | | for (int i = 0; i < count; i++) |
| | | { |
| | | locationCaches.Remove(removeItems[i]);//ç§»é¤æ¥è¯¢æ·»å éæåéè¶
è¿5åéçè´§ä½ |
| | | } |
| | | |
| | | List<string> lockLocations = locationCaches.Select(x => x.LocationCode).ToList(); |
| | | |
| | | List<Dt_LocationInfo> locationInfos = BaseDal.QueryData(x => x.RoadwayNo == roadwayNo);//æ¥è¯¢å··éææè´§ä½ä¿¡æ¯ |
| | | |
| | | Dictionary<string, OrderByType> orderBy = new Dictionary<string, OrderByType>() |
| | | { |
| | | { nameof(Dt_LocationInfo.Layer),OrderByType.Asc }, |
| | | { nameof(Dt_LocationInfo.Column),OrderByType.Asc }, |
| | | { nameof(Dt_LocationInfo.Depth),OrderByType.Desc }, |
| | | { nameof(Dt_LocationInfo.Row),OrderByType.Asc } |
| | | }; |
| | | |
| | | return BaseDal.QueryFirst(x => x.RoadwayNo == roadwayNo && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && x.EnableStatus != EnableStatusEnum.Disable.ObjToInt() && x.LocationType == palletType && !lockLocations.Contains(x.LocationCode), orderBy); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | MesOutbound = 200, |
| | | |
| | | /// <summary> |
| | | /// MES大å·PPåºåº |
| | | /// </summary> |
| | | [Description("MES大å·PPåºåº")] |
| | | MesPPOutbound = 205, |
| | | |
| | | /// <summary> |
| | | /// MESæå¨åºåº |
| | | /// </summary> |
| | | [Description("MESæå¨åºåº")] |
| | | MesHandOutbound = 210, |
| | | |
| | | |
| | | /// <summary> |
| | | /// MESå°å·PPåºåº |
| | | /// </summary> |
| | | [Description("MESå°å·PPåºåº")] |
| | | MesPPCutOutbound = 215, |
| | | |
| | | /// <summary> |
| | | /// MESæå¨æ£éåºåº |
| | |
| | | /// </summary> |
| | | [Description("é²çå°çº¿è¾¹å¤§ä»¶")] |
| | | MaskOutLarge = 275, |
| | | |
| | | /// <summary> |
| | | /// PPæ¬è¿è³çº¿è¾¹ |
| | | /// </summary> |
| | | [Description("PPæ¬è¿è³çº¿è¾¹")] |
| | | MesPPMove = 280, |
| | | |
| | | /// <summary> |
| | | /// éè´å
¥åº |
| | | /// </summary> |
| | |
| | | MesPalletSmallReturn = 585, |
| | | |
| | | /// <summary> |
| | | /// PPå
¥å¹³åº |
| | | /// </summary> |
| | | [Description("PPå
¥å¹³åº")] |
| | | PPPKInbound = 590, |
| | | |
| | | /// <summary> |
| | | /// 空箱å
¥åº |
| | | /// </summary> |
| | | [Description("空箱å
¥åº")] |
| | |
| | | /// é»çä» |
| | | /// </summary> |
| | | [Description("é»çä»")] |
| | | HA154 |
| | | HA154, |
| | | /// <summary> |
| | | /// PPå¹³åº |
| | | /// </summary> |
| | | [Description("PPå¹³åº")] |
| | | HA581 |
| | | } |
| | | public enum WarehouseTypEnum |
| | | { |
| | |
| | | LinqExpressionType expressionType = searchParametersList[i].DisplayType.GetLinqCondition(); |
| | | if (expressionType == LinqExpressionType.Equal) |
| | | { |
| | | where += $"{searchParametersList[i].Name} {HtmlElementType.Equal} '{results[j].Item3}'"; |
| | | where += $"[{searchParametersList[i].Name}] {HtmlElementType.Equal} '{results[j].Item3}'"; |
| | | } |
| | | else if (expressionType == LinqExpressionType.ThanOrEqual) |
| | | { |
| | |
| | | } |
| | | else if (expressionType == LinqExpressionType.Contains) |
| | | { |
| | | where += $"{searchParametersList[i].Name} {HtmlElementType.like} '%{searchParametersList[i].Value}%'"; |
| | | where += $"[{searchParametersList[i].Name}] {HtmlElementType.like} '%{searchParametersList[i].Value}%'"; |
| | | } |
| | | else |
| | | { |
| | |
| | | OutterCode, |
| | | |
| | | MatSerNumAnalysis, |
| | | ProSerNumAnalysis |
| | | ProSerNumAnalysis, |
| | | PPPKSerNumAnalysis |
| | | } |
| | | } |
| | |
| | | /// </summary> |
| | | [Description("åå§æ°æ®")] |
| | | BD, |
| | | |
| | | /// <summary> |
| | | /// ç©æé¿åº¦ |
| | | /// </summary> |
| | | [Description("ç©æé¿åº¦")] |
| | | ML, |
| | | } |
| | | } |
| | |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | public static T PPPKCodeAnalysis<T>(AnalysisCodeEnum analysisCode, string code) |
| | | { |
| | | Type type = typeof(T); |
| | | object? obj = Activator.CreateInstance(type); |
| | | if (obj == null) |
| | | throw new Exception("å®ä¾å对象é误"); |
| | | T result = (T)obj; |
| | | try |
| | | { |
| | | AnalysisRuleAttribute? analysisRule = type.GetCustomAttribute<AnalysisRuleAttribute>(); |
| | | if (analysisRule != null) |
| | | { |
| | | SqlSugarClient sugarClient = new SqlSugarClient(new ConnectionConfig |
| | | { |
| | | ConfigId = MainDb.CurrentDbConnId, |
| | | ConnectionString = DBContext.GetMainConnectionDb().Connection, |
| | | IsAutoCloseConnection = true, |
| | | DbType = MainDb.DbType, |
| | | }); |
| | | |
| | | dynamic ruleConfig = sugarClient.Queryable(MainDb.AnalysisRuleConfig, "x").Where(MainDb.AnalysisCode, "=", analysisCode.ToString()).First(); |
| | | if (ruleConfig != null) |
| | | { |
| | | string format = ruleConfig.Format; |
| | | string splitStr = ruleConfig.SplitStr; |
| | | List<string> items = format.Split(splitStr).ToList(); |
| | | List<string> codes = code.Split(splitStr).ToList(); |
| | | if (items.Count == codes.Count) |
| | | { |
| | | PropertyInfo[] propertyInfos = type.GetProperties(); |
| | | if (AnalysisRuleEnum.Split == analysisRule.AnalysisRule) |
| | | { |
| | | for (int i = 0; i < propertyInfos.Length; i++) |
| | | { |
| | | PropertyInfo propertyInfo = propertyInfos[i]; |
| | | AnalysisItemRuleAttribute? analysisItemRule = propertyInfo.GetCustomAttribute<AnalysisItemRuleAttribute>(); |
| | | if (analysisItemRule != null) |
| | | { |
| | | if (analysisItemRule.AnalysisFormaType == AnalysisFormatTypeEnum.BD) |
| | | { |
| | | propertyInfo.SetValue(result, code.ChangeType(propertyInfo.PropertyType)); |
| | | } |
| | | else |
| | | { |
| | | int index = items.IndexOf($"[{analysisItemRule.AnalysisFormaType}]"); |
| | | if (index != -1) |
| | | { |
| | | propertyInfo.SetValue(result, codes[index]); |
| | | } |
| | | else |
| | | { |
| | | string? codeItem = items.FirstOrDefault(x => x.Contains($"[{analysisItemRule.AnalysisFormaType}]")); |
| | | if (!string.IsNullOrEmpty(codeItem)) |
| | | { |
| | | index = items.IndexOf(codeItem); |
| | | if (index != -1) |
| | | { |
| | | string value = codes[index]; |
| | | string replaceStr = codeItem.Replace($"[{analysisItemRule.AnalysisFormaType}]", ""); |
| | | |
| | | propertyInfo.SetValue(result, value.Replace(replaceStr, "").ChangeType(propertyInfo.PropertyType)); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | throw new Exception($"è§£æé误,{ex.Message}"); |
| | | } |
| | | |
| | | (bool, string, object?) validateResult = ModelValidate.ValidateModelData(result, type); |
| | | if (!validateResult.Item1) |
| | | { |
| | | throw new Exception($"è§£æé误,{validateResult.Item2}"); |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | } |
| | | } |
| | |
| | | /// </summary> |
| | | [AnalysisItemRule(AnalysisFormatTypeEnum.BD), PropertyValidate("åå§æ°æ®", NotNullAndEmpty = true)] |
| | | public string SerialNumber { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç©æé¿åº¦ |
| | | /// </summary> |
| | | [AnalysisItemRule(AnalysisFormatTypeEnum.ML), PropertyValidate("åå§æ°æ®", NotNullAndEmpty = false)] |
| | | public string MaterielLength { get; set; } |
| | | } |
| | | } |
| | |
| | | /// <returns></returns> |
| | | List<string> GetCanOutLocationCodes(int warehouseId); |
| | | |
| | | |
| | | List<string> GetCanOutPPLocationCodes(int warehouseId); |
| | | |
| | | List<string> PPGetCanOutLocationCodes(int warehouseId); |
| | | |
| | | /// <summary> |
| | |
| | | /// æåå
¥åºä¸ä¼ ERP |
| | | /// </summary> |
| | | WebResponseContent FeedbackProIn(Dt_MesProInOrder mesProInOrder); |
| | | /// <summary> |
| | | /// PPå¹³åºç»ç |
| | | /// </summary> |
| | | /// <param name="palletCode"></param> |
| | | /// <param name="Initiallife"></param> |
| | | /// <param name="warehouseId"></param> |
| | | /// <param name="serNums"></param> |
| | | /// <returns></returns> |
| | | WebResponseContent PPPKMaterielGroup(string palletCode, int Initiallife, int warehouseId, List<string> serNums); |
| | | } |
| | | } |
| | |
| | | |
| | | //(List<Dt_StockInfo>, Dt_MesPPCutOutboundOrderDetail, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) AssignStockOutbound(Dt_MesPPCutOutboundOrder mesPPOutboundOrder, Dt_MesPPCutOutboundOrderDetail mesPPCutOutboundOrderDetail); |
| | | |
| | | public (List<Dt_StockInfo>, Dt_MesPPOutboundOrder, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) AssignPPStockOutbound(Dt_MesPPOutboundOrder mesPPOutboundOrder); |
| | | |
| | | public (List<Dt_StockInfo>, List<Dt_MesPPCutOutboundOrderDetail>, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) AssignPPCutStockOutbound(Dt_MesPPCutOutboundOrder mesPPCutOutboundOrder, List<Dt_MesPPCutOutboundOrderDetail> mesPPCutOutboundOrderDetails); |
| | | } |
| | | } |
| | |
| | | /// <param name="assignQuantity"></param> |
| | | /// <param name="taskNum"></param> |
| | | /// <returns></returns> |
| | | List<Dt_OutStockLockInfo> GetOutStockLockInfos(Dt_MesPPCutOutboundOrder mesPPCutOutboundOrder,Dt_MesPPCutOutboundOrderDetail mesPPCutOutboundOrderDetail, List<Dt_StockInfo> outStock, int? taskNum = null); |
| | | Dt_OutStockLockInfo GetOutStockLockInfos(Dt_MesPPCutOutboundOrder mesPPCutOutboundOrder,Dt_MesPPCutOutboundOrderDetail mesPPCutOutboundOrderDetail, Dt_StockInfo outStock, int? taskNum = null); |
| | | |
| | | |
| | | List<Dt_OutStockLockInfo> GetOutStockLockInfos(Dt_MesPPCutOutboundOrder mesPPCutOutboundOrder, Dt_MesPPCutOutboundOrderDetail mesPPCutOutboundOrderDetail, List<Dt_StockInfo> outStock, int? taskNum = null); |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | |
| | | |
| | | List<Dt_StockInfo> GetOutboundStocks(List<Dt_StockInfo> stockInfos, string materielCode, float needQuantity, out float residueQuantity); |
| | | |
| | | List<Dt_StockInfo> GetOutboundPPStocks(List<Dt_StockInfo> stockInfos, string materielCode, float needQuantity, out float residueQuantity,string targetAddressCode = ""); |
| | | |
| | | List<Dt_StockInfo> GetUseableStocks(string materielCode, string batchNo, int warehoseId); |
| | | |
| | | List<Dt_StockInfo> GetUseablePPStocks(string materielCode, string batchNo, int warehoseId); |
| | | |
| | | //List<Dt_StockInfo> GetUseableStocks(string materielCode, string batchNo,,string , int warehoseId); |
| | | |
| | | List<Dt_StockInfo> GetUseableStocks(string materielCode, string batchNo, string palletcode, int warehoseId); |
| | |
| | | /// <param name="warehouseId"></param> |
| | | /// <returns></returns> |
| | | public Task<WebResponseContent> TaskHandCancel(int taskNum); |
| | | |
| | | /// <summary> |
| | | /// PPå¹³åºç³è¯·å
¥åºä»»å¡ |
| | | /// </summary> |
| | | /// <param name="palletCode">æçå·</param> |
| | | /// <param name="stationCode">ç«å°å·</param> |
| | | /// <returns></returns> |
| | | WebResponseContent PPPKRequestInboundTask(SaveModel saveModel); |
| | | |
| | | /// <summary> |
| | | /// PPå¹³åºçææ¬è¿ä»»å¡ |
| | | /// </summary> |
| | | /// <param name="palletCode">æçå·</param> |
| | | /// <param name="stationCode">ç«å°å·</param> |
| | | /// <returns></returns> |
| | | public WebResponseContent PPTaskMove(string palletCode, string startPoint, int warehouseId, List<string> serNums); |
| | | } |
| | | } |
| | |
| | | { |
| | | return 4; |
| | | } |
| | | else if (warehouse.WarehouseCode == WarehouseEnum.HA581.ObjToString()) |
| | | { |
| | | Dt_PalletTypeInfo palletTypeInfo = _palletTypeInfoRepository.QueryFirst(x => x.CodeStartStr == palletCode.Substring(0, 2)); |
| | | if (palletTypeInfo == null) |
| | | { |
| | | throw new Exception($"æçå·é误"); |
| | | } |
| | | return palletTypeInfo.PalletType; |
| | | } |
| | | return -1; |
| | | } |
| | | /// <summary> |
| | |
| | | } |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | |
| | | public WebResponseContent PPPKMaterielGroup(string palletCode, int Initiallife, int warehouseId, List<string> serNums) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | Dt_Warehouse warehouse = _warehouseService.Repository.QueryFirst(x => x.WarehouseId == warehouseId); |
| | | if (warehouse == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°è¯¥ä»åºä¿¡æ¯"); |
| | | } |
| | | |
| | | List<MatSerNumAnalysisModel> models = CodeAnalysisHelper.CodeAnalysis<MatSerNumAnalysisModel>(AnalysisCodeEnum.PPPKSerNumAnalysis, serNums); |
| | | |
| | | if (models.Select(x => x.MaterielCode).Distinct().Count() > 1) |
| | | { |
| | | return WebResponseContent.Instance.Error($"ç©æä¸å¯æ··æ¾"); |
| | | } |
| | | //éªè¯å¤ææ¶é´æ ¼å¼ |
| | | WebResponseContent IsValidContent = IsValidMCDates(models); |
| | | if (!IsValidContent.Status) |
| | | { |
| | | return content.Error(IsValidContent.Message); |
| | | } |
| | | string materielCode = models.FirstOrDefault()?.MaterielCode ?? ""; |
| | | |
| | | int materielWidth = 0; |
| | | |
| | | if (materielCode.Contains("-")) |
| | | { |
| | | var model = models.FirstOrDefault(); |
| | | if (model != null && !string.IsNullOrEmpty(model.MaterielCode)) |
| | | { |
| | | var codeParts = model.MaterielCode.Split("-"); |
| | | if (codeParts.Length >= 2) |
| | | { |
| | | if (int.TryParse(codeParts[1], out int widthValue)) |
| | | { |
| | | materielWidth = widthValue; |
| | | } |
| | | else |
| | | { |
| | | materielWidth = 0; |
| | | } |
| | | |
| | | materielCode = codeParts[0]; |
| | | } |
| | | } |
| | | } |
| | | Dt_MaterielInfo materielInfo = _basicRepository.MaterielInfoRepository.QueryFirst(x => x.MaterielCode == materielCode); |
| | | if (materielInfo == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°è¯¥ç©æçä¿¡æ¯"); |
| | | } |
| | | |
| | | float beforeQuantity = 0; |
| | | |
| | | Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == palletCode).Includes(x => x.Details).First(); |
| | | |
| | | if (stockInfo == null) |
| | | { |
| | | stockInfo = new Dt_StockInfo() |
| | | { |
| | | PalletCode = palletCode, |
| | | StockStatus = StockStatusEmun.æå¨ç»çæå.ObjToInt(), |
| | | WarehouseId = warehouse.WarehouseId, |
| | | PalletType = GetPalletType(warehouse, palletCode), |
| | | Details = new List<Dt_StockInfoDetail>() |
| | | }; |
| | | } |
| | | else |
| | | { |
| | | if (stockInfo.StockStatus != StockStatusEmun.ç»çæå.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.æå¨ç»çæå.ObjToInt()) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æçå·éå¤"); |
| | | } |
| | | beforeQuantity = stockInfo.Details.Sum(x => x.StockQuantity); |
| | | } |
| | | if(materielWidth != 0&& materielWidth < 650 && stockInfo.PalletType > 1) |
| | | { |
| | | return WebResponseContent.Instance.Error("ä½äº650è£å宽çç©æè¯·ç¨å°æçæ¡ç éæ°ç»çï¼"); |
| | | } |
| | | else if(materielWidth != 0 && materielWidth >= 650 && stockInfo.PalletType < 2) |
| | | { |
| | | return WebResponseContent.Instance.Error("650è£å宽以ä¸çç©æè¯·ç¨å¤§æçæ¡ç éæ°ç»çï¼"); |
| | | } |
| | | List<Dt_StockInfoDetail> stockInfoDetails = new List<Dt_StockInfoDetail>(); |
| | | List<int> detailKeys = new List<int>(); |
| | | foreach (var model in models) |
| | | { |
| | | Dt_StockInfoDetail stockInfoDetail = new Dt_StockInfoDetail() |
| | | { |
| | | BatchNo = model.LotNo, |
| | | MaterielCode = model.MaterielCode, |
| | | MaterielName = materielInfo.MaterielName, |
| | | MaterielSpec = materielInfo.MaterielSpec, |
| | | OrderNo = "", |
| | | SerialNumber = model.SerialNumber, |
| | | StockQuantity = model.MaterielCode.Contains("-")? model.MaterielLength.ObjToInt():model.Quantity, |
| | | OutboundQuantity = 0, |
| | | Unit = materielInfo.MaterielUnit, |
| | | Status = StockStatusEmun.ç»çæå.ObjToInt(), |
| | | ProductionDate = model.ProductionDate, |
| | | EffectiveDate = model.EffectiveDate, |
| | | InboundOrderRowNo = 0, |
| | | }; |
| | | |
| | | if (stockInfo.Id > 0) |
| | | { |
| | | stockInfoDetail.StockId = stockInfo.Id; |
| | | } |
| | | stockInfo.Details.Add(stockInfoDetail); |
| | | |
| | | stockInfoDetails.Add(stockInfoDetail); |
| | | } |
| | | |
| | | float totalQuantity = stockInfo.Details.Sum(x => x.StockQuantity); |
| | | |
| | | _unitOfWorkManage.BeginTran(); |
| | | if (stockInfo.Id == 0) |
| | | { |
| | | _stockRepository.StockInfoRepository.Db.InsertNav(stockInfo).Include(x => x.Details).ExecuteCommand(); |
| | | } |
| | | else |
| | | { |
| | | _stockRepository.StockInfoRepository.Db.UpdateNav(stockInfo).Include(x => x.Details, new UpdateNavOptions() { OneToManyInsertOrUpdate = true }).ExecuteCommand(); |
| | | } |
| | | _recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfo, stockInfoDetails, beforeQuantity, totalQuantity, StockChangeTypeEnum.MaterielGroup); |
| | | _unitOfWorkManage.CommitTran(); |
| | | content.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | throw new Exception(mesResponseContent.StrMsg); |
| | | } |
| | | if (mesResponseContent.Content == null) |
| | | { |
| | | throw new Exception("QMSè¿åæ£éªç»æä¸ºç©º"); |
| | | } |
| | | //QMSåä¼ ç»æ |
| | | ReceiveResultDTO? receiveResult = JsonConvert.DeserializeObject<ReceiveResultDTO>(mesResponseContent.Content.ToString()); |
| | | if (receiveResult == null) |
| | |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false,Length =500,ColumnDescription = "ç©æè§æ ¼")] |
| | | public string MaterielSpec { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç©æé¿åº¦ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, ColumnDescription = "ç©æé¿åº¦")] |
| | | public decimal MaterielLength { get; set; } |
| | | } |
| | | } |
| | |
| | | /// ç©æç¼å· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "ç©æç¼å·")] |
| | | public string MaterielCode { get; set; } |
| | | public string MaterialCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç©æåç§° |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 200, ColumnDescription = "ç©æåç§°")] |
| | | public string MaterielName { get; set; } |
| | | public string MaterialName { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ¹æ¬¡å· |
| | |
| | | needQuantity -= assignQuantity; |
| | | if (mesPPOutboundOrderDetails.OrderQuantity > mesPPOutboundOrderDetails.LockQuantity) |
| | | { |
| | | List<Dt_StockInfo> stockInfos = _stockService.StockInfoService.GetUseableStocks(mesPPOutboundOrderDetails.MaterielCode, mesPPOutboundOrderDetails.BatchNo, OutboundOrder.WarehouseId); |
| | | List<Dt_StockInfo> stockInfos = _stockService.StockInfoService.GetUseableStocks(mesPPOutboundOrderDetails.MaterialCode, mesPPOutboundOrderDetails.BatchNo, OutboundOrder.WarehouseId); |
| | | stockInfos = stockInfos.Where(x => !stockSelectViews.Select(v => v.PalletCode).Contains(x.PalletCode)).ToList(); |
| | | List<Dt_StockInfo> autoAssignStocks = _stockService.StockInfoService.GetOutboundStocks(stockInfos, mesPPOutboundOrderDetails.MaterielCode, needQuantity, out float residueQuantity); |
| | | List<Dt_StockInfo> autoAssignStocks = _stockService.StockInfoService.GetOutboundStocks(stockInfos, mesPPOutboundOrderDetails.MaterialCode, needQuantity, out float residueQuantity); |
| | | mesPPOutboundOrderDetails.LockQuantity += needQuantity - residueQuantity; |
| | | outStocks.AddRange(autoAssignStocks); |
| | | mesPPOutboundOrderDetails.OrderDetailStatus = OrderDetailStatusEnum.AssignOver.ObjToInt(); |
| | |
| | | _basicService = basicService; |
| | | _recordService = recordService; |
| | | } |
| | | |
| | | #region PPåºåºï¼æ§ï¼ |
| | | //public (List<Dt_StockInfo>, Dt_MesPPOutboundOrder, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) AssignStockOutbound(Dt_MesPPOutboundOrder mesPPOutboundOrder) |
| | | //{ |
| | | // List<Dt_StockInfo> outStocks = new List<Dt_StockInfo>(); |
| | |
| | | |
| | | // return (outStocks, mesPPCutOutboundOrderDetail, outStockLockInfos, locationInfos); |
| | | //} |
| | | #endregion |
| | | |
| | | |
| | | /// <summary> |
| | | /// PP大å·åºåºï¼æ°ï¼ |
| | | /// </summary> |
| | | /// <param name="mesPPOutboundOrder"></param> |
| | | /// <returns></returns> |
| | | /// <exception cref="Exception"></exception> |
| | | public (List<Dt_StockInfo>, Dt_MesPPOutboundOrder, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) AssignPPStockOutbound(Dt_MesPPOutboundOrder mesPPOutboundOrder) |
| | | { |
| | | List<Dt_StockInfo> outStocks = new List<Dt_StockInfo>(); |
| | | |
| | | List<Dt_OutStockLockInfo> outStockLockInfos = new List<Dt_OutStockLockInfo>(); |
| | | List<Dt_LocationInfo> locationInfos = new List<Dt_LocationInfo>(); |
| | | |
| | | float originalNeedQuantity = mesPPOutboundOrder.OrderQuantity; |
| | | |
| | | float needQuantity = originalNeedQuantity; |
| | | //è·ååºå |
| | | List<Dt_StockInfo> stockInfos = _stockService.StockInfoService.GetUseablePPStocks(mesPPOutboundOrder.MaterialCode, "", mesPPOutboundOrder.WarehouseId); |
| | | if (!stockInfos.Any()) |
| | | { |
| | | throw new Exception($"æªæ¾å°å¯åé
åºå"); |
| | | } |
| | | List<Dt_StockInfo> autoAssignStocks = _stockService.StockInfoService.GetOutboundPPStocks(stockInfos, mesPPOutboundOrder.MaterialCode, needQuantity, out float residueQuantity); |
| | | if (residueQuantity > 0) |
| | | { |
| | | throw new Exception($"åºåä¸è¶³"); |
| | | } |
| | | autoAssignStocks.OrderBy(x => x.Details.FirstOrDefault()?.StockQuantity).ToList(); |
| | | outStocks.AddRange(autoAssignStocks); |
| | | for (int j = 0; j < autoAssignStocks.Count; j++) |
| | | { |
| | | float detailAssignQuantity = outStockLockInfos.Where(x => x.MaterielCode == mesPPOutboundOrder.MaterialCode).Sum(x => x.AssignQuantity);//åºåºè®¢åæç»å·²åé
æ°é |
| | | |
| | | float palletAssignQuantity = outStockLockInfos.Where(x => x.MaterielCode == mesPPOutboundOrder.MaterialCode && x.PalletCode == autoAssignStocks[j].PalletCode).Sum(x => x.AssignQuantity);//åºåºè¯¦æ
å·²åé
æ°é |
| | | |
| | | float palletOutboundQuantity = autoAssignStocks[j].Details.Sum(x => x.OutboundQuantity); |
| | | if (palletAssignQuantity < palletOutboundQuantity)//妿åºåºè¯¦æ
å·²åé
æ°éå°äºæçå·²åé
æ°éï¼åå¯ä»¥ç»§ç»æ·»å 该æçåºåºä¿¡æ¯ |
| | | { |
| | | float orderDetailNeedQuantity = mesPPOutboundOrder.OrderQuantity - detailAssignQuantity; |
| | | if (orderDetailNeedQuantity > autoAssignStocks[j].Details.Sum(x => x.OutboundQuantity) - palletAssignQuantity) |
| | | { |
| | | mesPPOutboundOrder.LockQuantity += autoAssignStocks[j].Details.Sum(x => x.OutboundQuantity) - palletAssignQuantity; |
| | | Dt_OutStockLockInfo outStockLockInfo = _outStockLockInfoService.GetOutStockLockInfo(mesPPOutboundOrder, autoAssignStocks[j], autoAssignStocks[j].Details.Sum(x => x.OutboundQuantity) - palletAssignQuantity); |
| | | outStockLockInfos.Add(outStockLockInfo); |
| | | } |
| | | else |
| | | { |
| | | Dt_OutStockLockInfo outStockLockInfo = _outStockLockInfoService.GetOutStockLockInfo(mesPPOutboundOrder, autoAssignStocks[j], mesPPOutboundOrder.OrderQuantity - mesPPOutboundOrder.LockQuantity); |
| | | outStockLockInfos.Add(outStockLockInfo); |
| | | mesPPOutboundOrder.LockQuantity = mesPPOutboundOrder.OrderQuantity; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | locationInfos.AddRange(_basicService.LocationInfoService.Repository.GetLocationInfos(outStocks.Select(x => x.LocationCode).ToList())); |
| | | |
| | | return (outStocks, mesPPOutboundOrder, outStockLockInfos, locationInfos); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// PPå°å·åºåºï¼æ°ï¼ |
| | | /// </summary> |
| | | /// <param name="mesPPOutboundOrder"></param> |
| | | /// <returns></returns> |
| | | /// <exception cref="Exception"></exception> |
| | | public (List<Dt_StockInfo>, List<Dt_MesPPCutOutboundOrderDetail>, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) AssignPPCutStockOutbound(Dt_MesPPCutOutboundOrder mesPPCutOutboundOrder,List<Dt_MesPPCutOutboundOrderDetail> mesPPCutOutboundOrderDetails) |
| | | { |
| | | List<Dt_StockInfo> outStocks = new List<Dt_StockInfo>(); |
| | | |
| | | List<Dt_OutStockLockInfo> outStockLockInfos = new List<Dt_OutStockLockInfo>(); |
| | | List<Dt_LocationInfo> locationInfos = new List<Dt_LocationInfo>(); |
| | | |
| | | foreach (var item in mesPPCutOutboundOrderDetails) |
| | | { |
| | | float originalNeedQuantity = item.OrderQuantity; |
| | | |
| | | float needQuantity = originalNeedQuantity; |
| | | //è·ååºå |
| | | List<Dt_StockInfo> stockInfos = _stockService.StockInfoService.GetUseablePPStocks(item.MaterialCode, "", mesPPCutOutboundOrder.WarehouseId); |
| | | if (!stockInfos.Any()) |
| | | { |
| | | throw new Exception($"æªæ¾å°å¯åé
åºå"); |
| | | } |
| | | List<Dt_StockInfo> autoAssignStocks = _stockService.StockInfoService.GetOutboundPPStocks(stockInfos, item.MaterialCode, needQuantity, out float residueQuantity,item.TargetAddressCode); |
| | | if (residueQuantity > 0) |
| | | { |
| | | throw new Exception($"åºåä¸è¶³"); |
| | | } |
| | | autoAssignStocks.OrderBy(x => x.Details.FirstOrDefault()?.StockQuantity).ToList(); |
| | | outStocks.AddRange(autoAssignStocks); |
| | | for (int j = 0; j < autoAssignStocks.Count; j++) |
| | | { |
| | | float detailAssignQuantity = outStockLockInfos.Where(x => x.MaterielCode == item.MaterialCode).Sum(x => x.AssignQuantity);//åºåºè®¢åæç»å·²åé
æ°é |
| | | |
| | | float palletAssignQuantity = outStockLockInfos.Where(x => x.MaterielCode == item.MaterialCode && x.PalletCode == autoAssignStocks[j].PalletCode).Sum(x => x.AssignQuantity);//åºåºè¯¦æ
å·²åé
æ°é |
| | | |
| | | float palletOutboundQuantity = autoAssignStocks[j].Details.Sum(x => x.OutboundQuantity); |
| | | if (palletAssignQuantity < palletOutboundQuantity)//妿åºåºè¯¦æ
å·²åé
æ°éå°äºæçå·²åé
æ°éï¼åå¯ä»¥ç»§ç»æ·»å 该æçåºåºä¿¡æ¯ |
| | | { |
| | | float orderDetailNeedQuantity = item.OrderQuantity - detailAssignQuantity; |
| | | if (orderDetailNeedQuantity > autoAssignStocks[j].Details.Sum(x => x.OutboundQuantity) - palletAssignQuantity) |
| | | { |
| | | item.LockQuantity += autoAssignStocks[j].Details.Sum(x => x.OutboundQuantity) - palletAssignQuantity; |
| | | Dt_OutStockLockInfo outStockLockInfo = _outStockLockInfoService.GetOutStockLockInfos(mesPPCutOutboundOrder, item, autoAssignStocks[j]); |
| | | outStockLockInfos.Add(outStockLockInfo); |
| | | } |
| | | else |
| | | { |
| | | Dt_OutStockLockInfo outStockLockInfo = _outStockLockInfoService.GetOutStockLockInfos(mesPPCutOutboundOrder, item , autoAssignStocks[j]); |
| | | outStockLockInfos.Add(outStockLockInfo); |
| | | item.LockQuantity = item.OrderQuantity; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | locationInfos.AddRange(_basicService.LocationInfoService.Repository.GetLocationInfos(outStocks.Select(x => x.LocationCode).ToList())); |
| | | |
| | | return (outStocks, mesPPCutOutboundOrderDetails, outStockLockInfos, locationInfos); |
| | | } |
| | | } |
| | | } |
| | |
| | | /// <param name="assignQuantity"></param> |
| | | /// <param name="taskNum"></param> |
| | | /// <returns></returns> |
| | | public Dt_OutStockLockInfo GetOutStockLockInfos(Dt_MesPPCutOutboundOrder mesPPCutOutboundOrder, Dt_MesPPCutOutboundOrderDetail mesPPCutOutboundOrderDetail, Dt_StockInfo outStock, int? taskNum = null) |
| | | { |
| | | |
| | | Dt_OutStockLockInfo outStockLockInfo = new Dt_OutStockLockInfo() |
| | | { |
| | | PalletCode = outStock.PalletCode, |
| | | AssignQuantity = outStock.Details.Where(x => x.MaterielCode == mesPPCutOutboundOrderDetail.MaterialCode).Sum(x => x.OutboundQuantity), |
| | | MaterielCode = mesPPCutOutboundOrderDetail.MaterialCode, |
| | | BatchNo = outStock.Details.FirstOrDefault().BatchNo, |
| | | LocationCode = outStock.LocationCode, |
| | | MaterielName = mesPPCutOutboundOrderDetail.MaterialName, |
| | | OrderDetailId = mesPPCutOutboundOrderDetail.Id, |
| | | OrderNo = mesPPCutOutboundOrder.OrderNo, |
| | | OrderType = mesPPCutOutboundOrder.OrderType, |
| | | OriginalQuantity = outStock.Details.Where(x => x.MaterielCode == mesPPCutOutboundOrderDetail.MaterialCode).Sum(x => x.StockQuantity), |
| | | Status = taskNum == null ? OutLockStockStatusEnum.å·²åé
.ObjToInt() : OutLockStockStatusEnum.åºåºä¸.ObjToInt(), |
| | | StockId = outStock.Id, |
| | | TaskNum = taskNum, |
| | | OrderQuantity = mesPPCutOutboundOrderDetail.OrderQuantity, |
| | | Unit = mesPPCutOutboundOrderDetail.Unit, |
| | | ProductionDate = outStock.Details.Where(x => x.MaterielCode == mesPPCutOutboundOrderDetail.MaterialCode).FirstOrDefault()?.ProductionDate, |
| | | EffectiveDate = outStock.Details.Where(x => x.MaterielCode == mesPPCutOutboundOrderDetail.MaterialCode).FirstOrDefault()?.EffectiveDate |
| | | }; |
| | | |
| | | |
| | | return outStockLockInfo; |
| | | } |
| | | |
| | | public List<Dt_OutStockLockInfo> GetOutStockLockInfos(Dt_MesPPCutOutboundOrder mesPPCutOutboundOrder, Dt_MesPPCutOutboundOrderDetail mesPPCutOutboundOrderDetail, List<Dt_StockInfo> outStock, int? taskNum = null) |
| | | { |
| | | List<Dt_OutStockLockInfo> outStockLockInfos = new List<Dt_OutStockLockInfo>(); |
| | |
| | | Dt_OutStockLockInfo outStockLockInfo = new Dt_OutStockLockInfo() |
| | | { |
| | | PalletCode = item.PalletCode, |
| | | AssignQuantity = item.Details.Where(x => x.MaterielCode == mesPPCutOutboundOrderDetail.MaterielCode).Sum(x => x.OutboundQuantity), |
| | | MaterielCode = mesPPCutOutboundOrderDetail.MaterielCode, |
| | | AssignQuantity = item.Details.Where(x => x.MaterielCode == mesPPCutOutboundOrderDetail.MaterialCode).Sum(x => x.OutboundQuantity), |
| | | MaterielCode = mesPPCutOutboundOrderDetail.MaterialCode, |
| | | BatchNo = item.Details.FirstOrDefault().BatchNo, |
| | | LocationCode = item.LocationCode, |
| | | MaterielName = mesPPCutOutboundOrderDetail.MaterielName, |
| | | MaterielName = mesPPCutOutboundOrderDetail.MaterialName, |
| | | OrderDetailId = mesPPCutOutboundOrderDetail.Id, |
| | | OrderNo = mesPPCutOutboundOrder.OrderNo, |
| | | OrderType = mesPPCutOutboundOrder.OrderType, |
| | | OriginalQuantity = item.Details.Where(x => x.MaterielCode == mesPPCutOutboundOrderDetail.MaterielCode).Sum(x => x.StockQuantity), |
| | | OriginalQuantity = item.Details.Where(x => x.MaterielCode == mesPPCutOutboundOrderDetail.MaterialCode).Sum(x => x.StockQuantity), |
| | | Status = taskNum == null ? OutLockStockStatusEnum.å·²åé
.ObjToInt() : OutLockStockStatusEnum.åºåºä¸.ObjToInt(), |
| | | StockId = item.Id, |
| | | TaskNum = taskNum, |
| | | OrderQuantity = mesPPCutOutboundOrderDetail.OrderQuantity, |
| | | Unit = mesPPCutOutboundOrderDetail.Unit, |
| | | ProductionDate = item.Details.Where(x => x.MaterielCode == mesPPCutOutboundOrderDetail.MaterielCode).FirstOrDefault()?.ProductionDate, |
| | | EffectiveDate = item.Details.Where(x => x.MaterielCode == mesPPCutOutboundOrderDetail.MaterielCode).FirstOrDefault()?.EffectiveDate |
| | | ProductionDate = item.Details.Where(x => x.MaterielCode == mesPPCutOutboundOrderDetail.MaterialCode).FirstOrDefault()?.ProductionDate, |
| | | EffectiveDate = item.Details.Where(x => x.MaterielCode == mesPPCutOutboundOrderDetail.MaterialCode).FirstOrDefault()?.EffectiveDate |
| | | }; |
| | | outStockLockInfos.Add(outStockLockInfo); |
| | | } |
| | |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Common.StockEnum; |
| | | using WIDESEA_Common.WareHouseEnum; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_Core.Enums; |
| | |
| | | residueQuantity = needQuantity; |
| | | return outStocks; |
| | | } |
| | | //PP大å·åºåºï¼æ°ï¼ |
| | | public List<Dt_StockInfo> GetOutboundPPStocks(List<Dt_StockInfo> stockInfos, string materielCode, float needQuantity, out float residueQuantity,string targetAddressCode = "") |
| | | { |
| | | List<Dt_StockInfo> outStocks = new List<Dt_StockInfo>(); |
| | | stockInfos = stockInfos.OrderBy(x => |
| | | x.WarehouseId == WarehouseEnum.HA581.ObjToInt()? 0 : |
| | | x.WarehouseId == WarehouseEnum.HA58.ObjToInt()? 1 : |
| | | 2 |
| | | ).ToList(); |
| | | |
| | | // è®¡ç®æ»å¯ç¨åºåï¼ä»
ç»è®¡æå®ç©æç¼ç ï¼ |
| | | float stockTotalQuantity = stockInfos |
| | | .Select(x => x.Details |
| | | .Where(d => d.MaterielCode == materielCode) |
| | | .Sum(v => v.StockQuantity - v.OutboundQuantity) |
| | | ).Sum(x => x); |
| | | |
| | | if (stockTotalQuantity >= needQuantity)//åºåå¤ |
| | | { |
| | | int index = 0; |
| | | while (needQuantity > 0 && index < stockInfos.Count) |
| | | { |
| | | Dt_StockInfo stockInfo = stockInfos[index]; |
| | | decimal useableStockQuantity = stockInfo.Details |
| | | .Where(x => x.MaterielCode == materielCode) |
| | | .Sum(x => (decimal)x.StockQuantity - (decimal)x.OutboundQuantity); |
| | | |
| | | if (useableStockQuantity < (decimal)needQuantity && useableStockQuantity > 0) |
| | | { |
| | | // å¯ç¨éä¸è¶³ï¼å
¨é¨åºåº |
| | | stockInfo.Details.ForEach(x => |
| | | { |
| | | if (x.MaterielCode == materielCode) |
| | | x.OutboundQuantity = x.StockQuantity; |
| | | }); |
| | | needQuantity = (float)((decimal)needQuantity - useableStockQuantity); |
| | | } |
| | | else if (useableStockQuantity > 0) |
| | | { |
| | | stockInfo.Details.ForEach(x => |
| | | { |
| | | if (x.StockQuantity > x.OutboundQuantity && x.MaterielCode == materielCode) |
| | | { |
| | | decimal currentStock = (decimal)x.StockQuantity; |
| | | decimal currentOutbound = (decimal)x.OutboundQuantity; |
| | | decimal currentNeed = (decimal)needQuantity; |
| | | decimal available = currentStock - currentOutbound; |
| | | |
| | | if (available >= currentNeed) |
| | | { |
| | | x.OutboundQuantity = (float)(currentOutbound + currentNeed); |
| | | needQuantity = 0; |
| | | } |
| | | else |
| | | { |
| | | needQuantity = (float)(currentNeed - available); |
| | | x.OutboundQuantity = x.StockQuantity; |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | // ä»
å°æå®é
åºåºçåºåå å
¥ç»æé |
| | | if (useableStockQuantity > 0) |
| | | { |
| | | stockInfo.Remark = targetAddressCode; |
| | | outStocks.Add(stockInfo); |
| | | } |
| | | |
| | | index++; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | throw new Exception("åºåä¸è¶³"); |
| | | } |
| | | residueQuantity = needQuantity; |
| | | return outStocks; |
| | | } |
| | | |
| | | public List<Dt_StockInfo> GetUseableStocks(string materielCode, string batchNo, int warehoseId) |
| | | { |
| | |
| | | |
| | | return BaseDal.GetStockInfos(materielCode, batchNo, locationCodes); |
| | | } |
| | | //PP大å·åºåº(æ°) |
| | | public List<Dt_StockInfo> GetUseablePPStocks(string materielCode, string batchNo, int warehoseId) |
| | | { |
| | | List<string> locationCodes = _basicRepository.LocationInfoRepository.GetCanOutPPLocationCodes(warehoseId); |
| | | |
| | | return BaseDal.GetStockInfos(materielCode, batchNo, locationCodes); |
| | | } |
| | | |
| | | public List<Dt_StockInfo> GetUseableStocks(string materielCode, string batchNo, string palletcode, int warehoseId) |
| | | { |
| | |
| | | using SqlSugar; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.Math; |
| | | using WIDESEA_Core.CodeConfigEnum; |
| | | using WIDESEA_DTO.Basic; |
| | | using System.Globalization; |
| | | using System.Collections; |
| | | |
| | | namespace WIDESEA_TaskInfoService |
| | | { |
| | |
| | | return model; |
| | | } |
| | | |
| | | public MesMaterialLotaAceptModel PPGetMesMaterialLotaAceptModel(Dt_StockInfo stockInfo, Dt_StockInfoDetail stockInfoDetail, string taskNo, string warehouseCode, float quantity, string cutedType = "", float ppWidth = 0) |
| | | { |
| | | MesMaterialLotaAceptModel model = new MesMaterialLotaAceptModel() |
| | | { |
| | | CarrierCode = stockInfo.PalletCode, |
| | | CutedType = cutedType, |
| | | ExpirationDate = stockInfoDetail.EffectiveDate, |
| | | MaterialBarCode = stockInfoDetail.SerialNumber, |
| | | MaterialCode = stockInfoDetail.MaterielCode, |
| | | MaterialLot = stockInfoDetail.MaterielCode + "," + stockInfoDetail.BatchNo, |
| | | MaterialName = stockInfoDetail.MaterielName, |
| | | PPWidth = ppWidth, |
| | | ProductionDate = stockInfoDetail.ProductionDate, |
| | | Quantity = quantity, |
| | | Supplier = "", |
| | | TaskNo = taskNo, |
| | | Type = 2, |
| | | WarehouseArea = warehouseCode, |
| | | WarehouseLocation = warehouseCode |
| | | }; |
| | | |
| | | return model; |
| | | } |
| | | /// <summary> |
| | | /// åºæ¿åºåº |
| | | /// </summary> |
| | |
| | | MesResponseContent modelCount = new MesResponseContent(); |
| | | try |
| | | { |
| | | |
| | | Dt_Warehouse warehouse = _basicService.WarehouseService.Repository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA58.ToString()); |
| | | if (warehouse == null) |
| | | { |
| | |
| | | }; |
| | | mesPPOutboundOrderDetail.Add(dt_MesPPOutboundOrderDetail); |
| | | } |
| | | Dt_MesPPOutboundOrder mesOutboundOrder = new Dt_MesPPOutboundOrder() |
| | | Dt_MesPPOutboundOrder mesPPOutboundOrder1 = new Dt_MesPPOutboundOrder() |
| | | { |
| | | CreateType = OrderCreateTypeEnum.UpperSystemPush.ObjToInt(), |
| | | MaterialCode = model.MaterialCode, |
| | |
| | | Details = mesPPOutboundOrderDetail |
| | | }; |
| | | #region |
| | | //Db.InsertNav(mesOutboundOrder).Include(x=>x.Details).ExecuteCommand(); |
| | | // List<Dt_Task> tasks = new List<Dt_Task>(); |
| | | List<Dt_Task> tasks = new List<Dt_Task>(); |
| | | |
| | | // List<Dt_StockInfo>? stockInfos = null; |
| | | // List<Dt_OutStockLockInfo>? outStockLockInfos = null; |
| | | // List<Dt_LocationInfo>? locationInfos = null; |
| | | // { |
| | | //(List<Dt_StockInfo>, Dt_MesPPOutboundOrder, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = _outboundService.MesPPOutboundOrderService.AssignStockOutbound(mesOutboundOrder); |
| | | // if (result.Item1 != null && result.Item1.Count > 0) |
| | | // { |
| | | // tasks = GetTasks(result.Item1, TaskTypeEnum.MesOutbound); |
| | | // result.Item2.OrderStatus = OrderDetailStatusEnum.Outbound.ObjToInt(); |
| | | // result.Item3.ForEach(x => |
| | | // { |
| | | // x.Status = OutLockStockStatusEnum.åºåºä¸.ObjToInt(); |
| | | // }); |
| | | List<Dt_StockInfo>? stockInfos = null; |
| | | List<Dt_OutStockLockInfo>? outStockLockInfos = null; |
| | | List<Dt_LocationInfo>? locationInfos = null; |
| | | List<Dt_MaterielCodeInfo> materielCodes = new List<Dt_MaterielCodeInfo>(); |
| | | { |
| | | (List<Dt_StockInfo>, Dt_MesPPOutboundOrder, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = _outboundService.MesPPOutboundOrderService.AssignPPStockOutbound(mesPPOutboundOrder1); |
| | | if (result.Item1 != null && result.Item1.Count > 0) |
| | | { |
| | | tasks = GetTasks(result.Item1, TaskTypeEnum.MesPPOutbound); |
| | | result.Item2.OrderStatus = OrderDetailStatusEnum.Outbound.ObjToInt(); |
| | | result.Item3.ForEach(x => |
| | | { |
| | | x.Status = OutLockStockStatusEnum.åºåºä¸.ObjToInt(); |
| | | }); |
| | | |
| | | // stockInfos = result.Item1; |
| | | // mesOutboundOrder = result.Item2; |
| | | // outStockLockInfos = result.Item3; |
| | | // locationInfos = result.Item4; |
| | | // mesPPOutboundOrderDetail.OrderDetailStatus = OrderDetailStatusEnum.Outbound.ObjToInt(); |
| | | stockInfos = result.Item1; |
| | | mesPPOutboundOrder1 = result.Item2; |
| | | outStockLockInfos = result.Item3; |
| | | locationInfos = result.Item4; |
| | | foreach (var item in mesPPOutboundOrderDetail) |
| | | { |
| | | item.OrderDetailStatus = OrderDetailStatusEnum.Over.ObjToInt(); |
| | | } |
| | | |
| | | // } |
| | | // else |
| | | // { |
| | | // throw new Exception("æ åºå"); |
| | | // } |
| | | // } |
| | | // tasks.ForEach(x => |
| | | // { |
| | | // x.TargetAddress = model.TargetAddressCode; |
| | | // }); |
| | | // _unitOfWorkManage.BeginTran(); |
| | | } |
| | | else |
| | | { |
| | | throw new Exception("æ åºå"); |
| | | } |
| | | } |
| | | tasks.ForEach(x => |
| | | { |
| | | if (x.Roadway.Contains("AGV_PP")) |
| | | { |
| | | x.TargetAddress = model.TargetAddressCode; |
| | | } |
| | | |
| | | // int id = BaseDal.AddData(tasks); |
| | | // outStockLockInfos.ForEach(x => |
| | | // { |
| | | // x.OrderNo = mesOutboundOrder.TaskNo; |
| | | // x.OrderDetailId = id; |
| | | // }); |
| | | // //_outboundService.MesPPOutboundOrderService.Repository.AddData(mesOutboundOrder); |
| | | // Db.InsertNav(mesOutboundOrder).Include(x => x.Details).ExecuteCommand(); |
| | | // if (stockInfos != null && stockInfos.Count > 0 && outStockLockInfos != null && outStockLockInfos.Count > 0 && locationInfos != null && locationInfos.Count > 0) |
| | | // { |
| | | // WebResponseContent content = _outboundService.MesOutboundOrderService.LockOutboundStockDataUpdate(stockInfos, outStockLockInfos, locationInfos, tasks: tasks); |
| | | |
| | | // if (!content.Status) |
| | | // { |
| | | // _unitOfWorkManage.RollbackTran(); |
| | | // return MesResponseContent.Instance.Error(content.Message); |
| | | // } |
| | | // } |
| | | // _unitOfWorkManage.CommitTran(); |
| | | // PushTasksToWCS(tasks); |
| | | |
| | | //} |
| | | #endregion |
| | | }); |
| | | _unitOfWorkManage.BeginTran(); |
| | | Db.InsertNav(mesOutboundOrder).Include(x => x.Details).ExecuteCommand(); |
| | | |
| | | int id = BaseDal.AddData(tasks); |
| | | outStockLockInfos.ForEach(x => |
| | | { |
| | | x.OrderNo = mesPPOutboundOrder1.TaskNo; |
| | | x.OrderDetailId = id; |
| | | }); |
| | | Db.InsertNav(mesPPOutboundOrder1).Include(x => x.Details).ExecuteCommand(); |
| | | if (stockInfos.Count > 0 && stockInfos != null) |
| | | { |
| | | var lkstockInfo = stockInfos.Where(x => x.LocationCode.Contains("SC01_PP")).ToList(); |
| | | if(lkstockInfo != null) |
| | | { |
| | | foreach (var item in lkstockInfo) |
| | | { |
| | | Dt_MaterielInfo materielInfo = BaseDal.Db.Queryable<Dt_MaterielInfo>().Where(x => x.MaterielCode == item.Details.FirstOrDefault().MaterielCode).First(); |
| | | if(materielInfo == null) |
| | | { |
| | | return MesResponseContent.Instance.Error($"æªæ¾å°ç©æç¼å·{item.Details.FirstOrDefault().MaterielCode}çç©æä¿¡æ¯"); |
| | | } |
| | | Dt_MaterielCodeInfo materielCodeInfo = new Dt_MaterielCodeInfo() |
| | | { |
| | | MaterielCode = item.Details.FirstOrDefault().MaterielCode, |
| | | MaterielName = materielInfo.MaterielName, |
| | | MaterielSpec = materielInfo.MaterielSpec, |
| | | LotNo = item.Details.FirstOrDefault().BatchNo, |
| | | ProductionDate = item.Details.FirstOrDefault().ProductionDate.ObjToDate(), |
| | | EffectiveDate = item.Details.FirstOrDefault().EffectiveDate.ObjToDate(), |
| | | PurchaseOrderNo = DateTime.Now.ToString("yyMMdd") + item.Details.FirstOrDefault().BatchNo, |
| | | Quantity = item.Details.FirstOrDefault().StockQuantity, |
| | | MaterielLength = (decimal)materielInfo.MaterielLength, |
| | | WarehouseId = warehouse.WarehouseId |
| | | }; |
| | | materielCodes.Add(materielCodeInfo); |
| | | } |
| | | Db.Insertable(materielCodes).ExecuteCommand(); |
| | | } |
| | | } |
| | | if (stockInfos != null && stockInfos.Count > 0 && outStockLockInfos != null && outStockLockInfos.Count > 0 && locationInfos != null && locationInfos.Count > 0) |
| | | { |
| | | WebResponseContent content = _outboundService.MesOutboundOrderService.LockOutboundStockDataUpdate(stockInfos, outStockLockInfos, locationInfos, tasks: tasks); |
| | | |
| | | if (!content.Status) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return MesResponseContent.Instance.Error(content.Message); |
| | | } |
| | | } |
| | | _unitOfWorkManage.CommitTran(); |
| | | var pktask = tasks.Where(x => x.Roadway.Contains("AGV_PP")).ToList(); |
| | | if(pktask != null&& pktask.Count>0) |
| | | { |
| | | PushTasksToWCS(pktask, "AGV_PP"); |
| | | } |
| | | var lktask = tasks.Where(x => x.Roadway.Contains("SC01_PP")).ToList(); |
| | | if (lktask != null&& lktask.Count>0) |
| | | { |
| | | PushTasksToWCS(lktask); |
| | | } |
| | | |
| | | #endregion |
| | | //_unitOfWorkManage.BeginTran(); |
| | | //Db.InsertNav(mesOutboundOrder).Include(x => x.Details).ExecuteCommand(); |
| | | //_unitOfWorkManage.CommitTran(); |
| | | return MesResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | |
| | | try |
| | | { |
| | | |
| | | Dt_Warehouse warehouse = _basicService.WarehouseService.Repository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA58.ToString()); |
| | | Dt_Warehouse warehouse = _basicService.WarehouseService.Repository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA581.ToString()); |
| | | if (warehouse == null) |
| | | { |
| | | return MesResponseContent.Instance.Error("ä»åºåºç¡ä¿¡æ¯æªé
ç½®"); |
| | |
| | | CreateType = OrderCreateTypeEnum.UpperSystemPush.ObjToInt(), |
| | | TaskNo = model.TaskNo, |
| | | OrderType = OutOrderTypeEnum.Issue.ObjToInt(), |
| | | OrderStatus = OutOrderStatusEnum.æªå¼å§.ObjToInt(), |
| | | OrderStatus = OutOrderStatusEnum.åºåºä¸.ObjToInt(), |
| | | WarehouseId = warehouse.WarehouseId, |
| | | Details = mesPPCutOutboundOrderDetail, |
| | | }; |
| | | _unitOfWorkManage.BeginTran(); |
| | | Db.InsertNav(mesPPOutboundOrder).Include(x => x.Details).ExecuteCommand(); |
| | | _unitOfWorkManage.CommitTran(); |
| | | |
| | | #region |
| | | //List<Dt_Task> tasks = new List<Dt_Task>(); |
| | | List<Dt_Task> tasks = new List<Dt_Task>(); |
| | | |
| | | //List<Dt_StockInfo>? stockInfos = null; |
| | | //List<Dt_OutStockLockInfo>? outStockLockInfos = null; |
| | | //List<Dt_LocationInfo>? locationInfos = null; |
| | | //{ |
| | | //(List<Dt_StockInfo>, Dt_MesPPCutOutboundOrderDetail, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = _outboundService.MesPPOutboundOrderService.AssignStockOutbound(mesPPOutboundOrder, mesPPCutOutboundOrderDetail); |
| | | // if (result.Item1 != null && result.Item1.Count > 0) |
| | | // { |
| | | // tasks = GetTasks(result.Item1, TaskTypeEnum.MesOutbound); |
| | | // result.Item2.OrderDetailStatus = OrderDetailStatusEnum.Outbound.ObjToInt(); |
| | | // result.Item3.ForEach(x => |
| | | // { |
| | | // x.Status = OutLockStockStatusEnum.åºåºä¸.ObjToInt(); |
| | | // }); |
| | | List<Dt_StockInfo>? stockInfos = null; |
| | | List<Dt_OutStockLockInfo>? outStockLockInfos = null; |
| | | List<Dt_LocationInfo>? locationInfos = null; |
| | | { |
| | | (List<Dt_StockInfo>, List<Dt_MesPPCutOutboundOrderDetail>, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = _outboundService.MesPPOutboundOrderService.AssignPPCutStockOutbound(mesPPOutboundOrder, mesPPCutOutboundOrderDetail); |
| | | if (result.Item1 != null && result.Item1.Count > 0) |
| | | { |
| | | tasks = GetTasks(result.Item1, TaskTypeEnum.MesPPCutOutbound); |
| | | result.Item2.ForEach(x => |
| | | { |
| | | x.OrderDetailStatus = OrderDetailStatusEnum.Outbound.ObjToInt(); |
| | | }); |
| | | result.Item3.ForEach(x => |
| | | { |
| | | x.Status = OutLockStockStatusEnum.åºåºä¸.ObjToInt(); |
| | | }); |
| | | |
| | | // stockInfos = result.Item1; |
| | | // mesPPCutOutboundOrderDetail = result.Item2; |
| | | // outStockLockInfos = result.Item3; |
| | | // locationInfos = result.Item4; |
| | | stockInfos = result.Item1; |
| | | mesPPCutOutboundOrderDetail = result.Item2; |
| | | outStockLockInfos = result.Item3; |
| | | locationInfos = result.Item4; |
| | | |
| | | // } |
| | | // else |
| | | // { |
| | | // throw new Exception("æ åºå"); |
| | | // } |
| | | //} |
| | | //tasks.ForEach(x => |
| | | //{ |
| | | // x.TargetAddress = mesPPCutOutboundOrderDetail.TargetAddressCode; |
| | | //}); |
| | | //_unitOfWorkManage.BeginTran(); |
| | | } |
| | | else |
| | | { |
| | | throw new Exception("æ åºå"); |
| | | } |
| | | } |
| | | |
| | | //int id = BaseDal.AddData(tasks); |
| | | //outStockLockInfos.ForEach(x => |
| | | //{ |
| | | // x.OrderNo = mesPPOutboundOrder.TaskNo; |
| | | // x.OrderDetailId = id; |
| | | //}); |
| | | ////_outboundService.MesPPOutboundOrderService.Repository.AddData(mesOutboundOrder); |
| | | |
| | | int id = BaseDal.AddData(tasks); |
| | | outStockLockInfos.ForEach(x => |
| | | { |
| | | x.OrderNo = mesPPOutboundOrder.TaskNo; |
| | | }); |
| | | |
| | | if (stockInfos != null && stockInfos.Count > 0 && outStockLockInfos != null && outStockLockInfos.Count > 0 && locationInfos != null && locationInfos.Count > 0) |
| | | { |
| | | WebResponseContent content = _outboundService.MesOutboundOrderService.LockOutboundStockDataUpdate(stockInfos, outStockLockInfos, locationInfos, tasks: tasks); |
| | | |
| | | if (!content.Status) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return MesResponseContent.Instance.Error(content.Message); |
| | | } |
| | | } |
| | | //Db.InsertNav(mesPPOutboundOrder).Include(x => x.Details).ExecuteCommand(); |
| | | //if (stockInfos != null && stockInfos.Count > 0 && outStockLockInfos != null && outStockLockInfos.Count > 0 && locationInfos != null && locationInfos.Count > 0) |
| | | //{ |
| | | // WebResponseContent content = _outboundService.MesOutboundOrderService.LockOutboundStockDataUpdate(stockInfos, outStockLockInfos, locationInfos, tasks: tasks); |
| | | |
| | | // if (!content.Status) |
| | | // { |
| | | // _unitOfWorkManage.RollbackTran(); |
| | | // return MesResponseContent.Instance.Error(content.Message); |
| | | // } |
| | | //} |
| | | //_unitOfWorkManage.CommitTran(); |
| | | //PushTasksToWCS(tasks, "AGV_PP"); |
| | | _unitOfWorkManage.CommitTran(); |
| | | PushTasksToWCS(tasks, "AGV_PP"); |
| | | #endregion |
| | | return MesResponseContent.Instance.OK(); |
| | | } |
| | |
| | | MesResponseContent content = new MesResponseContent(); |
| | | try |
| | | { |
| | | //é夿æ¥è¯¢ç«åº,å¹³åº |
| | | Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA58.ToString()); |
| | | List<Dt_StockInfo> stockInfos = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => |
| | | x.WarehouseId == warehouse.WarehouseId && |
| | | x.StockStatus == (int)StockStatusEmun.å
¥åºå®æ).Includes(x => x.Details).ToList(); |
| | | Dt_StockInfo? stockInfo = stockInfos.FirstOrDefault(x => x.Details.Any(x => x.MaterielCode == model.MaterialCode && x.CutedWidth == model.CutedWidth)); |
| | | if (stockInfo == null) |
| | | Dt_Warehouse lkwarehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA58.ToString()); |
| | | Dt_Warehouse pkwarehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA581.ToString()); |
| | | |
| | | if (lkwarehouse == null || pkwarehouse == null) |
| | | { |
| | | return content.Error($"PPä»ç«åº/å¹³åºï¼ç©æç¼å·:{model.MaterialCode},è£å宽:{model.CutedWidth},æªæ¾å°æ¤ç©æåºåä¿¡æ¯"); |
| | | return content.Error("ç«åºæå¹³åºä»åºä¿¡æ¯ä¸åå¨"); |
| | | } |
| | | var stock = stockInfo.Details.FirstOrDefault(); |
| | | if (stock != null) |
| | | |
| | | List<Dt_StockInfo> lkstockInfos = _stockRepository.StockInfoRepository.Db |
| | | .Queryable<Dt_StockInfo>() |
| | | .Where(x => x.WarehouseId == lkwarehouse.WarehouseId |
| | | && x.StockStatus == (int)StockStatusEmun.å
¥åºå®æ) |
| | | .Includes(x => x.Details) |
| | | .ToList(); |
| | | |
| | | List<Dt_StockInfo> lkTargetStockInfos = lkstockInfos |
| | | .Where(x => x.Details != null && x.Details.Any(d => d.MaterielCode == model.MaterialCode)) |
| | | .ToList(); |
| | | |
| | | List<Dt_StockInfo> pkstockInfos = _stockRepository.StockInfoRepository.Db |
| | | .Queryable<Dt_StockInfo>() |
| | | .Where(x => x.WarehouseId == pkwarehouse.WarehouseId |
| | | && x.StockStatus == (int)StockStatusEmun.å
¥åºå®æ) |
| | | .Includes(x => x.Details) |
| | | .ToList(); |
| | | |
| | | List<Dt_StockInfo> pkTargetStockInfos = pkstockInfos |
| | | .Where(x => x.Details != null && x.Details.Any(d => d.MaterielCode == model.MaterialCode)) |
| | | .ToList(); |
| | | |
| | | |
| | | decimal lkTotalQuantity = (decimal)lkTargetStockInfos |
| | | .SelectMany(x => x.Details ?? new List<Dt_StockInfoDetail>()) |
| | | .Where(d => d.MaterielCode == model.MaterialCode) |
| | | .Sum(d => d.StockQuantity); |
| | | |
| | | // å¹³åºæ»æ° |
| | | decimal pkTotalQuantity = (decimal)pkTargetStockInfos |
| | | .SelectMany(x => x.Details ?? new List<Dt_StockInfoDetail>()) |
| | | .Where(d => d.MaterielCode == model.MaterialCode) |
| | | .Sum(d => d.StockQuantity); |
| | | |
| | | if (lkTotalQuantity <= 0 && pkTotalQuantity <= 0) |
| | | { |
| | | content.Content = new |
| | | return content.Error($"PPä»ç«åº/å¹³åºï¼ç©æç¼å·:{model.MaterialCode},æªæ¾å°æ¤ç©æåºåä¿¡æ¯"); |
| | | } |
| | | |
| | | content.Content = new List<object> |
| | | { |
| | | MaterialCode = stock.MaterielCode, |
| | | Quantity = stock.StockQuantity, |
| | | Unit = stock.Unit, |
| | | Warehouse = warehouse.WarehouseCode, |
| | | WarehouseName = warehouse.WarehouseName, |
| | | CutedWidth = stock.CutedWidth, |
| | | CarrierCode = stockInfo.PalletCode, |
| | | MaterialLot = stock.BatchNo, |
| | | new |
| | | { |
| | | MaterialCode = model.MaterialCode, |
| | | Quantity = lkTotalQuantity, |
| | | Unit = lkTargetStockInfos.SelectMany(x => x.Details ?? new List<Dt_StockInfoDetail>()) |
| | | .Where(d => d.MaterielCode == model.MaterialCode) |
| | | .FirstOrDefault()?.Unit ?? "ç®±", |
| | | Warehouse = lkwarehouse.WarehouseCode, |
| | | WarehouseName = lkwarehouse.WarehouseName, |
| | | CutedWidth = 0, |
| | | CarrierCode = "", |
| | | MaterialLot = "", |
| | | }, |
| | | new |
| | | { |
| | | MaterialCode = model.MaterialCode, |
| | | Quantity = pkTotalQuantity, |
| | | Unit = pkTargetStockInfos.SelectMany(x => x.Details ?? new List<Dt_StockInfoDetail>()) |
| | | .Where(d => d.MaterielCode == model.MaterialCode) |
| | | .FirstOrDefault()?.Unit ?? "ç®±", |
| | | Warehouse = pkwarehouse.WarehouseCode, |
| | | WarehouseName = pkwarehouse.WarehouseName, |
| | | CutedWidth = 0, |
| | | CarrierCode = "", |
| | | MaterialLot = "", |
| | | } |
| | | }; |
| | | } |
| | | |
| | | return content.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return MesResponseContent.Instance.Error(ex.Message); |
| | | return MesResponseContent.Instance.Error($"æ¥è¯¢åºå失败ï¼{ex.Message}"); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | public WebResponseContent PPTaskMove(string palletCode, string startPoint, int warehouseId, List<string> serNums) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseId == warehouseId); |
| | | if (warehouse == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°è¯¥ä»åºä¿¡æ¯"); |
| | | } |
| | | |
| | | Dt_Task task = Repository.QueryFirst(x => x.PalletCode == palletCode && x.WarehouseId == warehouseId); |
| | | if (task != null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"该æçå·²çæä»»å¡"); |
| | | } |
| | | |
| | | List<MatSerNumAnalysisModel> models = CodeAnalysisHelper.CodeAnalysis<MatSerNumAnalysisModel>(AnalysisCodeEnum.PPPKSerNumAnalysis, serNums); |
| | | //éªè¯å¤ææ¶é´æ ¼å¼ |
| | | WebResponseContent IsValidContent = IsValidMCDates(models); |
| | | if (!IsValidContent.Status) |
| | | { |
| | | return content.Error(IsValidContent.Message); |
| | | } |
| | | |
| | | Dt_Task newTask = new Dt_Task() |
| | | { |
| | | CurrentAddress = startPoint, |
| | | Grade = 0, |
| | | NextAddress = "PPCuttingWarehouse", |
| | | PalletCode = palletCode, |
| | | Roadway = "AGV_PP", |
| | | SourceAddress = startPoint, |
| | | TargetAddress = "PPCuttingWarehouse", |
| | | TaskType = TaskTypeEnum.MesPPMove.ObjToInt(), |
| | | TaskStatus = TaskStatusEnum.New.ObjToInt(), |
| | | WarehouseId = warehouseId, |
| | | PalletType = 0, |
| | | MaterielCode = models.FirstOrDefault()?.MaterielCode, |
| | | Quantity = (float)models.FirstOrDefault()?.Quantity, |
| | | BatchNo = models.FirstOrDefault()?.LotNo |
| | | }; |
| | | if (palletCode.Contains("DJ")) |
| | | { |
| | | newTask.PalletType = 2; |
| | | } |
| | | else if (palletCode.Contains("XJ")) |
| | | { |
| | | newTask.PalletType = 1; |
| | | } |
| | | else |
| | | { |
| | | return WebResponseContent.Instance.Error("该æçç éè¯¯ï¼æä¸å±äºPPå¹³åº"); |
| | | } |
| | | _unitOfWorkManage.BeginTran(); |
| | | int taskId = BaseDal.AddData(newTask); |
| | | newTask.TaskId = taskId; |
| | | _unitOfWorkManage.CommitTran(); |
| | | PushTasksToWCS(new List<Dt_Task> { newTask }, "AGV_PP"); |
| | | content.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | public WebResponseContent IsValidMCDates(List<MatSerNumAnalysisModel> analysisModels) |
| | | { |
| | | string[] effDates = analysisModels.Select(x => x.EffectiveDate).Distinct().ToArray(); |
| | | string[] ProDates = analysisModels.Select(x => x.ProductionDate).Distinct().ToArray(); |
| | | foreach (string effDate in effDates) |
| | | { |
| | | string format = "yyyy-MM-dd"; // ç®æ æ ¼å¼ |
| | | DateTime parsedDate; |
| | | // è§£æå¹¶éªè¯æ ¼å¼ |
| | | bool isValid = DateTime.TryParseExact( |
| | | effDate, |
| | | format, |
| | | CultureInfo.InvariantCulture, |
| | | DateTimeStyles.None, |
| | | out parsedDate |
| | | ); |
| | | |
| | | if (!isValid) |
| | | { |
| | | return WebResponseContent.Instance.Error("æ ¼å¼æ æææ¥æä¸åæ³"); |
| | | } |
| | | } |
| | | foreach (string ProDate in ProDates) |
| | | { |
| | | string format = "yyyy-MM-dd"; // ç®æ æ ¼å¼ |
| | | DateTime parsedDate; |
| | | // è§£æå¹¶éªè¯æ ¼å¼ |
| | | bool isValid = DateTime.TryParseExact( |
| | | ProDate, |
| | | format, |
| | | CultureInfo.InvariantCulture, |
| | | DateTimeStyles.None, |
| | | out parsedDate |
| | | ); |
| | | |
| | | if (!isValid) |
| | | { |
| | | return WebResponseContent.Instance.Error("æ ¼å¼æ æææ¥æä¸åæ³"); |
| | | } |
| | | } |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.GetStockInfo(task.PalletCode); |
| | | |
| | | if(task.TaskType == TaskTypeEnum.MesPPMove.ObjToInt()) |
| | | { |
| | | |
| | | task.TaskStatus = TaskStatusEnum.Finish.ObjToInt(); |
| | | BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateTypeEnum.èªå¨å®æ : OperateTypeEnum.äººå·¥å®æ); |
| | | FeedBackWCSTaskCompleted(taskNum); |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | Dt_LocationInfo locationInfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task.SourceAddress); |
| | | if (stockInfo == null) |
| | | { |
| | |
| | | List<Dt_OutboundOrderDetail> outboundOrderDetails = new List<Dt_OutboundOrderDetail>(); |
| | | List<Dt_MesOutboundOrder> mesOutboundOrders = new List<Dt_MesOutboundOrder>(); |
| | | List<Dt_MesPPOutboundOrder> mesPPOutboundOrders = new List<Dt_MesPPOutboundOrder>(); |
| | | List<Dt_MesPPCutOutboundOrder> mesPPCutOutboundOrders = new List<Dt_MesPPCutOutboundOrder>(); |
| | | List<Dt_MesPPCutOutboundOrderDetail> mesPPCutOutboundOrderDetails = new List<Dt_MesPPCutOutboundOrderDetail>(); |
| | | Dt_CheckOrder? checkOrder = null; |
| | | Dt_OutboundOrder? outboundOrder = null; |
| | | Dt_MesPPCutOutboundOrder mesPPCutOutboundOrder = null; |
| | | if ((outStockLockInfos == null || outStockLockInfos.Count == 0) && warehouse.WarehouseCode != WarehouseEnum.HA64.ToString() && warehouse.WarehouseCode != WarehouseEnum.HA154.ToString() && (task.TaskType != TaskTypeEnum.OutEmpty.ObjToInt())) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°åºåºè¯¦æ
ä¿¡æ¯"); |
| | |
| | | mesOutboundOrders.Add(mesOutboundOrder); |
| | | } |
| | | } |
| | | //PPåºåºä»»å¡å®æå¤æããããããããããããããããã |
| | | else if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt() && warehouse.WarehouseCode == WarehouseEnum.HA58.ToString()) |
| | | //PP大å·åºåºä»»å¡å®æå¤æ |
| | | else if (task.TaskType == TaskTypeEnum.MesPPOutbound.ObjToInt() && (warehouse.WarehouseCode == WarehouseEnum.HA581.ToString()|| warehouse.WarehouseCode == WarehouseEnum.HA58.ToString())) |
| | | { |
| | | Dt_MesPPOutboundOrder mesPPOutboundOrder = _outboundService.MesPPOutboundOrderService.Repository.QueryFirst(x => x.OrderNo == item.OrderNo); |
| | | Dt_MesPPOutboundOrder mesPPOutboundOrder = _outboundService.MesPPOutboundOrderService.Repository.QueryFirst(x => x.TaskNo == item.OrderNo); |
| | | if (mesPPOutboundOrder != null) |
| | | { |
| | | mesPPOutboundOrder.OverOutQuantity = item.AssignQuantity; |
| | |
| | | mesPPOutboundOrder.OrderStatus = OrderDetailStatusEnum.Over.ObjToInt(); |
| | | } |
| | | mesPPOutboundOrders.Add(mesPPOutboundOrder); |
| | | } |
| | | } |
| | | else if (task.TaskType == TaskTypeEnum.MesPPCutOutbound.ObjToInt() && warehouse.WarehouseCode == WarehouseEnum.HA581.ToString()) |
| | | { |
| | | Dt_MesPPCutOutboundOrderDetail mesPPCutOutboundOrderDetail = _outboundService.MesPPCutOutboundOrderDetailService.Repository.QueryFirst(x => x.Id == item.OrderDetailId); |
| | | |
| | | if (mesPPCutOutboundOrderDetail != null) |
| | | { |
| | | mesPPCutOutboundOrder = _outboundService.MesPPCutOutboundOrderService.Repository.QueryFirst(x => x.Id == mesPPCutOutboundOrderDetail.OrderId); |
| | | if (mesPPCutOutboundOrder == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°MESå°å·åºåºåä¿¡æ¯"); |
| | | } |
| | | mesPPCutOutboundOrderDetail.OverOutQuantity = item.AssignQuantity; |
| | | if (mesPPCutOutboundOrderDetail.OverOutQuantity == mesPPCutOutboundOrderDetail.OrderQuantity) |
| | | { |
| | | mesPPCutOutboundOrderDetail.OrderDetailStatus = OrderDetailStatusEnum.Over.ObjToInt(); |
| | | } |
| | | mesPPCutOutboundOrderDetails.Add(mesPPCutOutboundOrderDetail); |
| | | } |
| | | } |
| | | else |
| | |
| | | BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateTypeEnum.èªå¨å®æ : OperateTypeEnum.äººå·¥å®æ); |
| | | |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, (LocationStatusEnum)beforeStatus, LocationStatusEnum.Free, LocationChangeType.OutboundCompleted, stockInfo.Details.FirstOrDefault()?.OrderNo ?? "", task.TaskNum); |
| | | _unitOfWorkManage.CommitTran(); |
| | | |
| | | //PPåºåºä»»å¡å®æå¤æããããããããããããããããã |
| | | //if (warehouse.WarehouseCode == WarehouseEnum.HA58.ToString() && task.TaskType == TaskTypeEnum.Outbound.ObjToInt()) |
| | | //{ |
| | | // _outboundService.MesPPOutboundOrderService.Repository.UpdateData(mesPPOutboundOrders); |
| | | // MesMaterialLotaAceptModel model = GetMesMaterialLotaAceptModel(stockInfo, stockInfo.Details.FirstOrDefault(), mesPPOutboundOrders.FirstOrDefault().TaskNo, warehouse.WarehouseCode, stockInfo.Details.Where(x => x.MaterielCode == mesPPOutboundOrders.FirstOrDefault().MaterialCode).Sum(x => x.StockQuantity)); |
| | | // UploadMesMaterialLotaAcept(model); |
| | | // _stockService.StockInfoService.Repository.DeleteAndMoveIntoHty(stockInfo, App.User.UserId == 0 ? OperateTypeEnum.èªå¨å®æ : OperateTypeEnum.äººå·¥å®æ); |
| | | // _stockService.StockInfoDetailService.Repository.DeleteAndMoveIntoHty(stockInfo.Details, App.User.UserId == 0 ? OperateTypeEnum.èªå¨å®æ : OperateTypeEnum.äººå·¥å®æ); |
| | | //} |
| | | |
| | | //PP大å·åºåºä»»å¡å®æå¤æ |
| | | if (task.TaskType == TaskTypeEnum.MesPPOutbound.ObjToInt() && (warehouse.WarehouseCode == WarehouseEnum.HA581.ToString() || warehouse.WarehouseCode == WarehouseEnum.HA58.ToString())) |
| | | { |
| | | _outboundService.MesPPOutboundOrderService.Repository.UpdateData(mesPPOutboundOrders); |
| | | MesMaterialLotaAceptModel model = PPGetMesMaterialLotaAceptModel(stockInfo, stockInfo.Details.FirstOrDefault(), mesPPOutboundOrders.FirstOrDefault().TaskNo, warehouse.WarehouseCode, stockInfo.Details.Where(x => x.MaterielCode == mesPPOutboundOrders.FirstOrDefault().MaterialCode).Sum(x => x.StockQuantity)); |
| | | UploadMesMaterialLotaAcept(model); |
| | | _stockService.StockInfoService.Repository.DeleteAndMoveIntoHty(stockInfo, App.User.UserId == 0 ? OperateTypeEnum.èªå¨å®æ : OperateTypeEnum.äººå·¥å®æ); |
| | | _stockService.StockInfoDetailService.Repository.DeleteAndMoveIntoHty(stockInfo.Details, App.User.UserId == 0 ? OperateTypeEnum.èªå¨å®æ : OperateTypeEnum.äººå·¥å®æ); |
| | | } |
| | | //PPå°å·åºåºä»»å¡å®æå¤æ |
| | | if (task.TaskType == TaskTypeEnum.MesPPCutOutbound.ObjToInt() && warehouse.WarehouseCode == WarehouseEnum.HA581.ToString()) |
| | | { |
| | | _outboundService.MesPPCutOutboundOrderDetailService.Repository.UpdateData(mesPPCutOutboundOrderDetails); |
| | | |
| | | int completedDetailCount = mesPPCutOutboundOrderDetails.Count(x => x.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt()); |
| | | // å¤ææææç»æ¯å¦å®æ |
| | | if (completedDetailCount == mesPPCutOutboundOrderDetails.Count) |
| | | { |
| | | mesPPCutOutboundOrder.OrderStatus = OutOrderStatusEnum.åºåºå®æ.ObjToInt(); |
| | | _outboundService.MesPPCutOutboundOrderService.UpdateData(mesPPCutOutboundOrder); |
| | | } |
| | | MesMaterialLotaAceptModel model = PPGetMesMaterialLotaAceptModel(stockInfo, stockInfo.Details.FirstOrDefault(), mesPPCutOutboundOrder.TaskNo, warehouse.WarehouseCode, stockInfo.Details.Where(x => x.MaterielCode == mesPPCutOutboundOrderDetails.FirstOrDefault().MaterialCode).Sum(x => x.StockQuantity)); |
| | | UploadMesMaterialLotaAcept(model); |
| | | _stockService.StockInfoService.Repository.DeleteAndMoveIntoHty(stockInfo, App.User.UserId == 0 ? OperateTypeEnum.èªå¨å®æ : OperateTypeEnum.äººå·¥å®æ); |
| | | _stockService.StockInfoDetailService.Repository.DeleteAndMoveIntoHty(stockInfo.Details, App.User.UserId == 0 ? OperateTypeEnum.èªå¨å®æ : OperateTypeEnum.äººå·¥å®æ); |
| | | } |
| | | |
| | | |
| | | if (warehouse.WarehouseCode != WarehouseEnum.HA64.ToString() && task.TaskType == TaskTypeEnum.Outbound.ObjToInt()) |
| | | { |
| | | _outboundService.OutboundOrderService.TestOutUpload(outboundOrderDetails.FirstOrDefault().OrderId, outStockLockInfos); |
| | |
| | | MesMaterialLotaAceptModel model = GetMesMaterialLotaAceptModel(stockInfo, stockInfo.Details.FirstOrDefault(), mesOutboundOrders.FirstOrDefault().TaskNo, warehouse.WarehouseCode, stockInfo.Details.Where(x => x.MaterielCode == mesOutboundOrders.FirstOrDefault().MaterialCode).Sum(x => x.StockQuantity)); |
| | | UploadMesMaterialLotaAcept(model); |
| | | } |
| | | |
| | | _unitOfWorkManage.CommitTran(); |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | |
| | | { |
| | | return content.Error($"åºåä¿¡æ¯å·²åå¨"); |
| | | } |
| | | |
| | | Dt_Task task = BaseDal.QueryFirst(x => x.PalletCode == palletCode); |
| | | if(task != null) |
| | | { |
| | | return content.Error($"æç{palletCode}å·²ç»åå¨ä»»å¡ï¼è¯·å¿éå¤ä¸è¾¾"); |
| | | } |
| | | Dt_PalletTypeInfo palletTypeInfo = _palletTypeInfoRepository.QueryFirst(x=>x.CodeStartStr== palletType); |
| | | if (palletTypeInfo == null) |
| | | { |
| | |
| | | } |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// PPå¹³åºç³è¯·å
¥åºä»»å¡ |
| | | /// </summary> |
| | | /// <param name="saveModel"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent PPPKRequestInboundTask(SaveModel saveModel) |
| | | { |
| | | try |
| | | { |
| | | var palletCode = saveModel.MainData["barcode"].ToString(); |
| | | var warehouseId = saveModel.MainData["warehouseId"].ObjToInt(); |
| | | var stationCode = saveModel.MainData["startPoint"].ToString(); |
| | | Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseId == warehouseId); |
| | | if (warehouse == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°åºåº"); |
| | | } |
| | | |
| | | Dt_Task task = Repository.QueryFirst(x => x.PalletCode == palletCode && x.WarehouseId == warehouseId); |
| | | if (task != null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"该æçå·²çæä»»å¡"); |
| | | } |
| | | |
| | | Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == palletCode).Includes(x => x.Details).First(); |
| | | if (stockInfo == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°ç»çä¿¡æ¯"); |
| | | } |
| | | if (stockInfo.StockStatus != StockStatusEmun.ç»çæå.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.æå¨ç»çæå.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.æ£é宿.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.鿣åºå宿.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.çç¹åºå宿.ObjToInt()) |
| | | { |
| | | return WebResponseContent.Instance.Error($"该æçç¶æä¸æ£ç¡®,ä¸å¯ç³è¯·å
¥åº"); |
| | | } |
| | | if (!string.IsNullOrEmpty(stockInfo.LocationCode)) |
| | | { |
| | | return WebResponseContent.Instance.Error($"该æçå·²ç»å®è´§ä½"); |
| | | } |
| | | if (warehouseId != stockInfo.WarehouseId) |
| | | { |
| | | return WebResponseContent.Instance.Error($"ä»åºä¸æ£ç¡®"); |
| | | } |
| | | |
| | | Dt_LocationInfo? locationInfoPPPK = _basicService.LocationInfoService.AssignLocation("AGV_PP", stockInfo.PalletType, stockInfo.WarehouseId); |
| | | if (locationInfoPPPK == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"è´§ä½åé
失败,æªæ¾å°å¯åé
è´§ä½"); |
| | | } |
| | | Dt_Task newTask = new Dt_Task() |
| | | { |
| | | CurrentAddress = stationCode, |
| | | Grade = 0, |
| | | NextAddress = "", |
| | | PalletCode = palletCode, |
| | | Roadway = "AGV_PP", |
| | | SourceAddress = stationCode, |
| | | TargetAddress = locationInfoPPPK.LocationCode, |
| | | TaskType = TaskTypeEnum.PPPKInbound.ObjToInt(), |
| | | TaskStatus = TaskStatusEnum.New.ObjToInt(), |
| | | WarehouseId = stockInfo.WarehouseId, |
| | | PalletType = stockInfo.PalletType, |
| | | MaterielCode = stockInfo.Details?.Where(x => x.StockId == stockInfo.Id).FirstOrDefault()?.MaterielCode, |
| | | Quantity = (float)stockInfo.Details?.Where(x => x.StockId == stockInfo.Id).Sum(x => x.StockQuantity), |
| | | BatchNo = stockInfo.Details?.Where(x => x.StockId == stockInfo.Id).FirstOrDefault()?.BatchNo |
| | | }; |
| | | if (stockInfo.StockStatus == StockStatusEmun.æå¨ç»çæå.ObjToInt()) |
| | | { |
| | | stockInfo.StockStatus = StockStatusEmun.æå¨ç»çå
¥åºç¡®è®¤.ObjToInt(); |
| | | } |
| | | else |
| | | { |
| | | stockInfo.StockStatus = StockStatusEmun.å
¥åºç¡®è®¤.ObjToInt(); |
| | | } |
| | | |
| | | _unitOfWorkManage.BeginTran(); |
| | | LocationStatusEnum lastStatusPPorGM = (LocationStatusEnum)locationInfoPPPK.LocationStatus; |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfoPPPK, lastStatusPPorGM, LocationStatusEnum.Lock, LocationChangeType.InboundAssignLocation); |
| | | _basicService.LocationInfoService.UpdateLocationStatus(locationInfoPPPK, newTask.PalletType, LocationStatusEnum.Lock, newTask.WarehouseId); |
| | | int taskId = BaseDal.AddData(newTask); |
| | | newTask.TaskId = taskId; |
| | | _stockRepository.StockInfoRepository.UpdateData(stockInfo); |
| | | _unitOfWorkManage.CommitTran(); |
| | | PushTasksToWCS(new List<Dt_Task> { newTask },"AGV_PP"); |
| | | return WebResponseContent.Instance.OK(data: newTask); |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | NextAddress = "", |
| | | Roadway = locationInfo.RoadwayNo, |
| | | SourceAddress = stockInfo.LocationCode, |
| | | TargetAddress = "", |
| | | TargetAddress = stockInfo.Remark??"", |
| | | TaskStatus = TaskStatusEnum.New.ObjToInt(), |
| | | TaskType = taskType.ObjToInt(), |
| | | TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)), |
| | |
| | | { |
| | | return Service.GetWarehouseMaterielInfos(warehouseId); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// PPå¹³åºç©æç è§£æ |
| | | /// </summary> |
| | | /// <param name="serNum"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, HttpGet, Route("PPPKCodeAnalysis")] |
| | | public WebResponseContent PPPKCodeAnalysis(string serNum) |
| | | { |
| | | try |
| | | { |
| | | MatSerNumAnalysisModel model = CodeAnalysisHelper.PPPKCodeAnalysis<MatSerNumAnalysisModel>(AnalysisCodeEnum.PPPKSerNumAnalysis, serNum); |
| | | return WebResponseContent.Instance.OK(data: model); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | return Service.MaterielGroup(palletCode, initiallife, warehouseId, serNums); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ å
¥åºåç»ç |
| | | /// </summary> |
| | | /// <param name="palletCode"></param> |
| | | /// <param name="initiallife"></param> |
| | | /// <param name="warehouseId"></param> |
| | | /// <param name="serNums"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, HttpGet, Route("PPPKManualMaterielGroup")] |
| | | public WebResponseContent PPPKMaterielGroup(string palletCode, int initiallife, int warehouseId, [FromBody] List<string> serNums) |
| | | { |
| | | return Service.PPPKMaterielGroup(palletCode, initiallife, warehouseId, serNums); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | return MesResponseContent.Instance.OK("æå"); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// çæå¹³åºæ¬è¿ä»»å¡ |
| | | /// </summary> |
| | | /// <param name="orderDetailId"></param> |
| | | /// <param name="stockSelectViews"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, HttpGet, Route("PPTaskMove"), AllowAnonymous] |
| | | public WebResponseContent PPTaskMove(string palletCode, string startPoint, int warehouseId, [FromBody] List<string> serNums) |
| | | { |
| | | return _taskService.PPTaskMove(palletCode, startPoint,warehouseId,serNums); |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | return await Service.TaskHandCancel(taskNum); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// PPç³è¯·å
¥åºä»»å¡ |
| | | /// </summary> |
| | | /// <param name="saveModel"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, HttpGet, Route("PPPKRequestInboundTask"), AllowAnonymous] |
| | | public WebResponseContent PPPKRequestInboundTask([FromBody] SaveModel saveModel) |
| | | { |
| | | return Service.PPPKRequestInboundTask(saveModel); |
| | | } |
| | | } |
| | | } |
| | |
| | | CreateMap<ErpProductWarehousingOrderDTO, Dt_ErpProInOrder>().ForMember(x => x.ProSaleOrderNo, b => b.MapFrom(b => b.SaleOrder)).ForMember(x => x.Remark, b => b.MapFrom(b => b.Note)).ForMember(x => x.UpperOrderNo, b => b.MapFrom(b => b.TransferNo)).ForMember(x => x.ProStockAttribute, b => b.MapFrom(b => ProStockAttributeEnum.æå.ObjToInt())).ForMember(x => x.ProInStatus, b => b.MapFrom(b => InOrderStatusEnum.æªå¼å§.ObjToInt())); |
| | | CreateMap<ErpProductTransferOrderDTO, Dt_ErpProTransferOrder>().ForMember(x => x.ProSaleOrderNo, b => b.MapFrom(b => b.SaleOrder)).ForMember(x => x.Remark, b => b.MapFrom(b => b.Note)).ForMember(x => x.UpperOrderNo, b => b.MapFrom(b => b.TransferNo)).ForMember(x => x.OrderType, b => b.MapFrom(b => ErpProOutTypeEnum.ProOutAllocat.ObjToInt())).ForMember(x => x.ProStockAttribute, b => b.MapFrom(b => ProStockAttributeEnum.ç å.ObjToInt())); |
| | | CreateMap<ErpProOutLingOrder, Dt_ProCollectOutOrderDetail>().ForMember(x => x.ProOrderDetailStatus, b => b.MapFrom(b => 0)).ForMember(x => x.OverQtyPcs, b => b.MapFrom(b => 0)).ForMember(x => x.LockQtyPcs, b => b.MapFrom(b => 0)); |
| | | |
| | | CreateMap<MaterialDetail, Dt_MesPPCutOutboundOrderDetail>().ForMember(x => x.OrderDetailStatus, b => b.MapFrom(b => 0)).ForMember(x => x.OrderQuantity, b => b.MapFrom(b => b.RequiredQuantity)); |
| | | } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view class="page-container"> |
| | | <!-- é¡¶é¨å¯¼èªæ --> |
| | | <view class="nav-header"> |
| | | <uni-segmented-control |
| | | :current="current" |
| | | :values="items" |
| | | @clickItem="onClickItem" |
| | | class="segmented-control" |
| | | > |
| | | </uni-segmented-control> |
| | | </view> |
| | | |
| | | <!-- 主å
å®¹åº --> |
| | | <view class="main-content"> |
| | | <!-- ç»ç模å --> |
| | | <view v-if="current === 0" class="card-container"> |
| | | <!-- ç»ç表åå¡ç --> |
| | | <view class="form-card"> |
| | | <uni-forms class="form-wrapper" label-width="80px"> |
| | | <uni-forms-item label="æçæ¡ç :" class="form-item"> |
| | | <uni-easyinput |
| | | type="text" |
| | | placeholder="è¯·æ«ææçæ¡ç " |
| | | :focus="barcodeFocus" |
| | | v-model="barcode" |
| | | @confirm="onBarcodeConfirm" |
| | | class="input-field" |
| | | :disabled="isSubmitting" |
| | | /> |
| | | </uni-forms-item> |
| | | |
| | | <uni-forms-item label="å
ç®±æ ç¾:" class="form-item"> |
| | | <uni-easyinput |
| | | type="text" |
| | | placeholder="è¯·æ«æå
ç®±æ ç¾" |
| | | :focus="materSnFocus" |
| | | v-model="materSn" |
| | | @confirm="onMaterSnConfirm" |
| | | class="input-field" |
| | | :disabled="isSubmitting" |
| | | /> |
| | | </uni-forms-item> |
| | | |
| | | <uni-forms-item :label="Testlabel" v-if="Test" class="form-item"> |
| | | <uni-easyinput |
| | | type="text" |
| | | :placeholder="Testplaceholder" |
| | | v-model="Initiallife" |
| | | class="input-field" |
| | | :disabled="isSubmitting" |
| | | /> |
| | | </uni-forms-item> |
| | | |
| | | <view class="form-actions"> |
| | | <button |
| | | @click="submit" |
| | | type="primary" |
| | | class="btn-primary" |
| | | :disabled="isSubmitting" |
| | | > |
| | | <uni-icons type="refresh" size="16" v-if="isSubmitting"></uni-icons> |
| | | {{isSubmitting ? 'ç»çä¸...' : 'ç»ç'}} |
| | | </button> |
| | | </view> |
| | | </uni-forms> |
| | | </view> |
| | | |
| | | <!-- ç©æä¿¡æ¯å表 --> |
| | | <view class="list-card" v-if="matInfos.length > 0"> |
| | | <view class="list-header"> |
| | | <text class="list-title">ç©æä¿¡æ¯</text> |
| | | <text class="count-badge">1</text> |
| | | </view> |
| | | |
| | | <uni-list class="material-list"> |
| | | <uni-list-item |
| | | direction="column" |
| | | v-for="(item,index) in matInfos" |
| | | :key="index" |
| | | class="list-item" |
| | | > |
| | | <template v-slot:body> |
| | | <view class="list-item-content"> |
| | | <uni-icons |
| | | type="trash" |
| | | size="20" |
| | | class="delete-icon" |
| | | @click="deleteList(index)" |
| | | :disabled="isSubmitting" |
| | | > |
| | | </uni-icons> |
| | | |
| | | <view class="info-grid"> |
| | | <view class="info-row"> |
| | | <text class="label">éè´åå·ï¼</text> |
| | | <text class="value">{{item.purchaseOrderNo}}</text> |
| | | </view> |
| | | <view class="info-row"> |
| | | <text class="label">ç©æç¼ç ï¼</text> |
| | | <text class="value">{{item.materielCode}}</text> |
| | | </view> |
| | | <view class="info-row"> |
| | | <text class="label">æ¹æ¬¡å·ï¼</text> |
| | | <text class="value">{{item.lotNo}}</text> |
| | | </view> |
| | | <view class="info-row"> |
| | | <text class="label">æ°éï¼</text> |
| | | <text class="value">{{item.quantity}}</text> |
| | | </view> |
| | | <view class="info-row"> |
| | | <text class="label">çäº§æ¥æï¼</text> |
| | | <text class="value">{{item.productionDate}}</text> |
| | | </view> |
| | | <view class="info-row"> |
| | | <text class="label">æææï¼</text> |
| | | <text class="value">{{item.effectiveDate}}</text> |
| | | </view> |
| | | <view class="info-row"> |
| | | <text class="label">ç©æé¿åº¦ï¼</text> |
| | | <text class="value">{{item.materielLength}}</text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | </uni-list-item> |
| | | </uni-list> |
| | | </view> |
| | | |
| | | <!-- ç©ºç¶ææç¤º --> |
| | | <view class="empty-state" v-if="matInfos.length === 0 && barcode"> |
| | | <uni-icons type="empty" size="60" color="#ccc"></uni-icons> |
| | | <text class="empty-text">ææ ç©æä¿¡æ¯ï¼è¯·æ«æå
ç®±æ ç¾</text> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- å
¥åºæ¨¡åï¼ä¿æä¸åï¼ --> |
| | | <view v-if="current === 1" class="card-container"> |
| | | <view class="form-card"> |
| | | <uni-forms class="form-wrapper" label-width="80px"> |
| | | <uni-forms-item label="æçæ¡ç :" class="form-item"> |
| | | <uni-easyinput |
| | | type="text" |
| | | placeholder="è¯·æ«ææçæ¡ç " |
| | | :focus="!addressFocus" |
| | | v-model="inboundBarcode" |
| | | @confirm="inputChangebarcode" |
| | | class="input-field" |
| | | :disabled="isInboundSubmitting" |
| | | /> |
| | | </uni-forms-item> |
| | | |
| | | <uni-forms-item label="å°åæ¡ç :" class="form-item"> |
| | | <uni-easyinput |
| | | type="text" |
| | | placeholder="è¯·æ«æå°åæ¡ç " |
| | | :focus="addressFocus" |
| | | v-model="address" |
| | | class="input-field" |
| | | :disabled="addressdisabled || isInboundSubmitting" |
| | | /> |
| | | </uni-forms-item> |
| | | |
| | | <view class="form-actions"> |
| | | <button |
| | | @click="inbound" |
| | | type="primary" |
| | | class="btn-primary" |
| | | :disabled="isInboundSubmitting" |
| | | > |
| | | <uni-icons type="refresh" size="16" v-if="isInboundSubmitting"></uni-icons> |
| | | {{isInboundSubmitting ? 'å
¥åºä¸...' : 'å
¥åºç¡®è®¤'}} |
| | | </button> |
| | | </view> |
| | | </uni-forms> |
| | | </view> |
| | | |
| | | <view class="list-card" v-if="inboundBarcode"> |
| | | <view class="summary-card" v-if="Summmary > 0"> |
| | | <text class="summary-label">ç»çæ»æ°éï¼</text> |
| | | <text class="summary-value">{{Summmary}}</text> |
| | | </view> |
| | | |
| | | <uni-list class="material-list" v-if="stockInfoDetail.length > 0"> |
| | | <uni-list-item direction="column" v-for="(item,index) in stockInfoDetail" :key="index"> |
| | | <template v-slot:body> |
| | | <view class="list-item-content"> |
| | | <view class="info-grid"> |
| | | <view class="info-row"><text class="label">ç©æç¼å·ï¼</text><text class="value">{{item.materielCode}}</text></view> |
| | | <view class="info-row"><text class="label">ç©æåç§°ï¼</text><text class="value">{{item.materielName}}</text></view> |
| | | <view class="info-row"><text class="label">ç©ææ¹æ¬¡ï¼</text><text class="value">{{item.batchNo}}</text></view> |
| | | <view class="info-row"><text class="label">ç»çæ°éï¼</text><text class="value">{{item.stockQuantity}}</text></view> |
| | | <view class="info-row"><text class="label">çäº§æ¥æï¼</text><text class="value">{{item.productionDate}}</text></view> |
| | | <view class="info-row"><text class="label">æææï¼</text><text class="value">{{item.effectiveDate}}</text></view> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | </uni-list-item> |
| | | </uni-list> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | |
| | | <u-toast ref="uToast" /> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | const innerAudioContext = uni.createInnerAudioContext(); |
| | | export default { |
| | | data() { |
| | | return { |
| | | items: ['ç»ç', 'å
¥åº'], |
| | | current: 0, |
| | | // ç»çæ¨¡åæ°æ® |
| | | matInfos: [], |
| | | orderNo: "", |
| | | barcode: "", |
| | | materSn: "", |
| | | Initiallife: 1000, |
| | | sns: [], |
| | | // ç»çç¦ç¹æ§å¶ |
| | | barcodeFocus: true, // æçæ¡ç åå§è·å¾ç¦ç¹ |
| | | materSnFocus: false, // å
ç®±æ ç¾ç¦ç¹ |
| | | // å
¥åºæ¨¡åæ°æ® |
| | | addressFocus: false, |
| | | inboundBarcode: "", |
| | | address: "", |
| | | warehouseId: "", |
| | | Test: false, |
| | | Testlabel: "", |
| | | Testplaceholder: "", |
| | | Testcheck: false, |
| | | Summmary: 0, |
| | | stockInfoDetail: [], |
| | | addressdisabled: false, |
| | | isSubmitting: false, |
| | | isInboundSubmitting: false |
| | | } |
| | | }, |
| | | onLoad(res) { |
| | | this.orderNo = res.orderNo; |
| | | this.warehouseId = res.warehouseId; |
| | | |
| | | if (this.warehouseId == 6) { |
| | | this.Test = true; |
| | | this.Testlabel = "åå§å¯¿å½:"; |
| | | this.Testplaceholder = "请è¾å
¥åå§å¯¿å½"; |
| | | } else if (this.warehouseId == 2) { |
| | | this.Test = true; |
| | | this.Testlabel = "æ°é:"; |
| | | this.Testplaceholder = "请è¾å
¥æ°é"; |
| | | this.Initiallife = 16; |
| | | } else if (this.warehouseId == 3) { |
| | | this.address = "1011"; |
| | | this.addressdisabled = true; |
| | | } |
| | | |
| | | // ç¡®ä¿åå§ç¦ç¹å¨æçæ¡ç |
| | | this.barcodeFocus = true; |
| | | this.materSnFocus = false; |
| | | }, |
| | | methods: { |
| | | getData() {}, |
| | | onClickItem(e) { |
| | | this.current = e.currentIndex; |
| | | // 忢é项塿¶éç½®ç¦ç¹ |
| | | if (this.current === 0) { |
| | | this.barcodeFocus = true; |
| | | this.materSnFocus = false; |
| | | } else { |
| | | this.addressFocus = false; |
| | | } |
| | | }, |
| | | |
| | | // ==================== ç»ç模åç¦ç¹è·³è½¬ ==================== |
| | | /** |
| | | * æçæ¡ç æ«æç¡®è®¤ |
| | | * æ«æåèªå¨è·³è½¬å°å
ç®±æ ç¾è¾å
¥æ¡ |
| | | */ |
| | | onBarcodeConfirm() { |
| | | if (!this.barcode || this.barcode.trim() === '') { |
| | | this.$refs.uToast.show({ |
| | | title: "è¯·æ«ææçæ¡ç ", |
| | | type: 'error' |
| | | }); |
| | | // ä¿æç¦ç¹å¨æçæ¡ç æ¡ |
| | | this.barcodeFocus = true; |
| | | this.materSnFocus = false; |
| | | return; |
| | | } |
| | | // æçç ææï¼è·³è½¬å°å
ç®±æ ç¾ |
| | | this.barcodeFocus = false; |
| | | this.materSnFocus = true; |
| | | }, |
| | | |
| | | /** |
| | | * å
ç®±æ ç¾æ«æç¡®è®¤ |
| | | * èªå¨è§£æå
ç®±ç ï¼æ¸
空è¾å
¥æ¡ï¼ç¦ç¹ä¿çå¨å
ç®±æ ç¾æ¡ |
| | | */ |
| | | onMaterSnConfirm() { |
| | | if (!this.materSn || this.materSn.trim() === '') { |
| | | this.$refs.uToast.show({ |
| | | title: "è¯·æ«æå
ç®±æ ç¾", |
| | | type: 'error' |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | // ç¹æ®å¤çï¼ä»åº11æ¶å»æåç¼ |
| | | let snToProcess = this.materSn; |
| | | if (this.warehouseId == 11) { |
| | | snToProcess = snToProcess.replace(/,SC.*/, ''); |
| | | } |
| | | |
| | | // å
ç®±ç æ ¼å¼æ ¡éªï¼å¿
é¡»å
å«7ä¸ªåæ®µï¼ä»¥éå·åéï¼ |
| | | if (snToProcess.split(',').length != 7) { |
| | | this.$refs.uToast.show({ |
| | | title: "å
ç®±ç æ ¼å¼é误ï¼è¯·éæ°æ«æ", |
| | | type: 'error' |
| | | }); |
| | | // æ¸
空è¾å
¥æ¡ï¼ä¾¿äºéæ°æ«æ |
| | | this.materSn = ""; |
| | | // ç¦ç¹ä¸å¨ï¼materSnFocus å·²æ¯ trueï¼ |
| | | return; |
| | | } |
| | | |
| | | // åèµ·å端解æè¯·æ± |
| | | this.$u.post('/api/MaterielInfo/PPPKCodeAnalysis?serNum=' + snToProcess, {}) |
| | | .then(res => { |
| | | if (res.status) { |
| | | // è§£ææåï¼æ¿æ¢ä¸ºææ°çå
ç®±ç ï¼åªä¿çä¸ä¸ªï¼ |
| | | this.sns = [res.data.serialNumber]; |
| | | this.matInfos = [res.data]; |
| | | |
| | | this.$refs.uToast.show({ |
| | | title: "å
ç®±ç å·²æ´æ°", |
| | | type: "success", |
| | | duration: 1500 |
| | | }); |
| | | // æ¸
空è¾å
¥æ¡ï¼ä¸ºä¸ä¸æ¬¡æ«æååå¤ï¼ç¦ç¹ä»å¨å
ç®±ç æ¡ï¼ |
| | | this.materSn = ""; |
| | | // ç¦ç¹ä¸å¨ï¼ä¿æå¨å
ç®±ç æ¡ï¼materSnFocus å·²æ¯ trueï¼ |
| | | } else { |
| | | this.$refs.uToast.show({ |
| | | title: res.message, |
| | | type: "error" |
| | | }); |
| | | // è§£æå¤±è´¥ï¼æ¸
空è¾å
¥æ¡ï¼è®©ç¨æ·éæ°æ«æ |
| | | this.materSn = ""; |
| | | } |
| | | }) |
| | | .catch(err => { |
| | | this.$refs.uToast.show({ |
| | | title: err.message || "è§£æå¤±è´¥", |
| | | type: "error" |
| | | }); |
| | | this.materSn = ""; |
| | | }); |
| | | }, |
| | | |
| | | // å é¤å
ç®±ç ï¼æ¸
ç©ºï¼ |
| | | deleteList() { |
| | | if (this.isSubmitting) return; |
| | | this.matInfos = []; |
| | | this.sns = []; |
| | | this.$refs.uToast.show({ |
| | | title: "å
ç®±ç å·²æ¸
空", |
| | | type: "info" |
| | | }); |
| | | // ç¦ç¹ä¿çå¨å
ç®±ç æ¡ |
| | | }, |
| | | |
| | | // ==================== ç»çæäº¤ ==================== |
| | | submit() { |
| | | if (this.isSubmitting) return; |
| | | if (!this.barcode) { |
| | | this.$refs.uToast.show({ title: "è¯·æ«ææçæ¡ç ", type: 'error' }); |
| | | this.resetFocusToBarcode(); |
| | | return; |
| | | } |
| | | if (this.matInfos.length === 0) { |
| | | this.$refs.uToast.show({ title: "è¯·æ«æå
ç®±æ ç¾", type: 'error' }); |
| | | this.resetFocusToMaterSn(); |
| | | return; |
| | | } |
| | | if (this.Test && !this.Testcheck) { |
| | | this.Testcheck = true; |
| | | this.$refs.uToast.show({ |
| | | title: this.warehouseId == 2 ? "请确认æ°é" : "请确认åå§å¯¿å½", |
| | | type: 'error' |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | if (this.warehouseId == 2) { |
| | | let sn = this.sns[0]; |
| | | this.sns = Array(this.Initiallife).fill(sn); |
| | | } |
| | | |
| | | this.isSubmitting = true; |
| | | let url = `palletCode=${this.barcode}&initiallife=${this.Initiallife}&warehouseId=${this.warehouseId}`; |
| | | |
| | | this.$u.post('/api/InboundOrder/PPPKManualMaterielGroup?' + url, this.sns) |
| | | .then(res => { |
| | | if (res.status) { |
| | | this.$refs.uToast.show({ title: "ç»çæå", type: "success" }); |
| | | // é置表å |
| | | this.barcode = ""; |
| | | this.matInfos = []; |
| | | this.sns = []; |
| | | // éç½®ç¦ç¹ï¼åå°æçæ¡ç æ¡ï¼å¼å§æ°çä¸è½® |
| | | this.resetFocusToBarcode(); |
| | | } else { |
| | | this.$refs.uToast.show({ title: res.message, type: "error" }); |
| | | } |
| | | }) |
| | | .finally(() => { |
| | | this.isSubmitting = false; |
| | | }); |
| | | }, |
| | | |
| | | // ==================== ç¦ç¹éç½®è¾
å© ==================== |
| | | resetFocusToBarcode() { |
| | | this.barcodeFocus = true; |
| | | this.materSnFocus = false; |
| | | }, |
| | | resetFocusToMaterSn() { |
| | | this.barcodeFocus = false; |
| | | this.materSnFocus = true; |
| | | }, |
| | | |
| | | // ==================== å
¥åºæ¨¡åï¼ä¿æåé»è¾ï¼ ==================== |
| | | inputChangebarcode() { |
| | | this.addressFocus = false; |
| | | this.$nextTick(() => { |
| | | if (!this.inboundBarcode) return; |
| | | this.addressFocus = true; |
| | | this.$u.post('/api/StockInfo/StockQueryData', { |
| | | MainData: { barcode: this.inboundBarcode, warehouseId: this.warehouseId } |
| | | }).then(res => { |
| | | this.stockInfoDetail = []; |
| | | this.Summmary = 0; |
| | | if (res.status) { |
| | | this.stockInfoDetail = res.data.details; |
| | | this.stockInfoDetail.forEach(item => { |
| | | this.Summmary += item.stockQuantity; |
| | | }); |
| | | } else { |
| | | this.$refs.uToast.show({ title: res.message, type: "error" }); |
| | | } |
| | | }) |
| | | }) |
| | | }, |
| | | |
| | | inbound() { |
| | | if (this.isInboundSubmitting) return; |
| | | if (!this.inboundBarcode) { |
| | | this.$refs.uToast.show({ title: "è¯·æ«ææçæ¡ç ", type: "error" }); |
| | | return; |
| | | } |
| | | if (!this.address) { |
| | | this.$refs.uToast.show({ title: "è¯·æ«æå°åæ¡ç ", type: "error" }); |
| | | return; |
| | | } |
| | | |
| | | this.isInboundSubmitting = true; |
| | | this.$u.post('/api/Task/PPPKRequestInboundTask', { |
| | | MainData: { |
| | | barcode: this.inboundBarcode, |
| | | startPoint: this.address, |
| | | warehouseId: this.warehouseId |
| | | } |
| | | }).then(res => { |
| | | if (res.status) { |
| | | this.inboundBarcode = ""; |
| | | if (this.warehouseId != 3) this.address = ""; |
| | | this.stockInfoDetail = []; |
| | | this.Summmary = 0; |
| | | this.$refs.uToast.show({ title: "å
¥åºæå", type: "success" }); |
| | | } else { |
| | | this.$refs.uToast.show({ title: res.message, type: "error" }); |
| | | } |
| | | }).finally(() => { |
| | | this.isInboundSubmitting = false; |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss"> |
| | | @import '@/common/uni-ui.scss'; |
| | | page { background-color: #f5f7fa; font-size: 14px; color: #333; } |
| | | .page-container { min-height: 100vh; display: flex; flex-direction: column; } |
| | | .nav-header { background: #fff; padding: 12px 16px; box-shadow: 0 2px 8px rgba(0,0,0,0.05); } |
| | | .segmented-control { border-radius: 8px; --uni-segmented-control-height: 40px; } |
| | | .main-content { flex: 1; padding: 16px; } |
| | | .card-container { display: flex; flex-direction: column; gap: 16px; } |
| | | .form-card { background: #fff; border-radius: 12px; padding: 20px; box-shadow: 0 2px 12px rgba(0,0,0,0.04); } |
| | | .form-item { margin-bottom: 16px; } |
| | | .input-field { border-radius: 8px; height: 44px; } |
| | | .form-actions { margin-top: 10px; } |
| | | .btn-primary { width: 100%; height: 48px; border-radius: 8px; } |
| | | .list-card { background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 12px rgba(0,0,0,0.04); } |
| | | .list-header { padding: 16px; border-bottom: 1px solid #f0f0f0; display: flex; justify-content: space-between; } |
| | | .count-badge { background: #e6f4ff; color: #165dff; padding: 2px 8px; border-radius: 20px; font-size: 12px; } |
| | | .list-item-content { position: relative; padding: 16px; } |
| | | .delete-icon { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: #ef4444; } |
| | | .info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; } |
| | | .info-row { display: flex; flex-direction: column; } |
| | | .label { font-size: 12px; color: #6b7280; } |
| | | .value { font-size: 14px; color: #222; font-weight: 500; } |
| | | .summary-card { padding: 16px; background: #e6f4ff; font-size: 15px; } |
| | | .summary-value { font-weight: bold; color: #165dff; margin-left: 6px; } |
| | | .empty-state { padding: 50px 20px; text-align: center; color: #999; } |
| | | </style> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view class="page-container"> |
| | | <!-- é¡¶é¨å¯¼èªæ --> |
| | | <view class="nav-header"> |
| | | <uni-segmented-control |
| | | :current="current" |
| | | :values="items" |
| | | @clickItem="onClickItem" |
| | | class="segmented-control" |
| | | > |
| | | </uni-segmented-control> |
| | | </view> |
| | | |
| | | <!-- 主å
å®¹åº --> |
| | | <view class="main-content"> |
| | | <!-- çæPPæ¬è¿ä»»å¡æ¨¡å --> |
| | | <view v-if="current === 0" class="card-container"> |
| | | <!-- 表åå¡ç --> |
| | | <view class="form-card"> |
| | | <uni-forms class="form-wrapper" label-width="80px"> |
| | | <!-- æçæ¡ç è¾å
¥æ¡ï¼åå§è·å¾ç¦ç¹ï¼æ«æåèªå¨è·³è½¬å°èµ·å§å°å --> |
| | | <uni-forms-item label="æçæ¡ç :" class="form-item"> |
| | | <uni-easyinput |
| | | type="text" |
| | | placeholder="è¯·æ«ææçæ¡ç " |
| | | :focus="barcodeFocus" |
| | | v-model="barcode" |
| | | @confirm="onBarcodeConfirm" |
| | | class="input-field" |
| | | /> |
| | | </uni-forms-item> |
| | | |
| | | <!-- èµ·å§å°åæ«ææ¡ï¼æçç æ«æåèªå¨èç¦ï¼æ«æå跳转å°å
ç®±ç --> |
| | | <uni-forms-item label="èµ·å§å°å:" class="form-item"> |
| | | <uni-easyinput |
| | | type="text" |
| | | placeholder="è¯·æ«æèµ·å§å°å" |
| | | :focus="startPointFocus" |
| | | v-model="startPoint" |
| | | @confirm="onStartPointConfirm" |
| | | class="input-field" |
| | | /> |
| | | </uni-forms-item> |
| | | |
| | | <!-- å
ç®±æ ç¾è¾å
¥æ¡ï¼èµ·å§å°åæ«æåèªå¨èç¦ï¼æ«æå触åå端解æï¼ä¸èªå¨è·³è½¬ --> |
| | | <uni-forms-item label="å
ç®±æ ç¾:" class="form-item"> |
| | | <uni-easyinput |
| | | type="text" |
| | | placeholder="è¯·æ«æå
ç®±æ ç¾" |
| | | :focus="materSnFocus" |
| | | v-model="materSn" |
| | | @confirm="onMaterSnConfirm" |
| | | class="input-field" |
| | | /> |
| | | <!-- å·²éå
ç®±ç æç¤º --> |
| | | <view class="selected-tip" v-if="matInfos.length > 0"> |
| | | <text class="tip-text">å½åå·²éï¼</text> |
| | | <text class="sn-text">{{matInfos[0].serialNumber || matInfos[0].materielCode}}</text> |
| | | <uni-icons type="clear" size="14" class="clear-icon" @click="clearSn"></uni-icons> |
| | | </view> |
| | | </uni-forms-item> |
| | | |
| | | <!-- ç¹æ®ä»åºåæ®µï¼æµè¯æ¶/æ²¹å¢¨ï¼ --> |
| | | <uni-forms-item :label="Testlabel" v-if="Test" class="form-item"> |
| | | <uni-easyinput |
| | | type="text" |
| | | :placeholder="Testplaceholder" |
| | | v-model="Initiallife" |
| | | class="input-field" |
| | | /> |
| | | </uni-forms-item> |
| | | |
| | | <view class="form-actions"> |
| | | <button |
| | | @click="generatePPTask" |
| | | type="primary" |
| | | class="btn-primary" |
| | | :disabled="isSubmitting" |
| | | > |
| | | <uni-icons type="refresh" size="16" v-if="isSubmitting"></uni-icons> |
| | | {{isSubmitting ? 'çæä¸...' : 'çæPPæ¬è¿ä»»å¡'}} |
| | | </button> |
| | | </view> |
| | | </uni-forms> |
| | | </view> |
| | | |
| | | <!-- å表å¡çï¼å±ç¤ºå
ç®±ç ç©æä¿¡æ¯ --> |
| | | <view class="list-card" v-if="matInfos.length > 0"> |
| | | <view class="list-header"> |
| | | <text class="list-title">ç©æä¿¡æ¯</text> |
| | | <text class="count-badge">1</text> |
| | | </view> |
| | | |
| | | <uni-list class="material-list"> |
| | | <uni-list-item |
| | | direction="column" |
| | | v-for="(item,index) in matInfos" |
| | | :key="index" |
| | | class="list-item" |
| | | > |
| | | <template v-slot:body> |
| | | <view class="list-item-content"> |
| | | <uni-icons |
| | | type="trash" |
| | | size="20" |
| | | class="delete-icon" |
| | | @click="deleteList(index)" |
| | | > |
| | | </uni-icons> |
| | | |
| | | <view class="info-grid"> |
| | | <view class="info-row"> |
| | | <text class="label">éè´åå·ï¼</text> |
| | | <text class="value">{{item.purchaseOrderNo}}</text> |
| | | </view> |
| | | <view class="info-row"> |
| | | <text class="label">ç©æç¼ç ï¼</text> |
| | | <text class="value">{{item.materielCode}}</text> |
| | | </view> |
| | | <view class="info-row"> |
| | | <text class="label">æ¹æ¬¡å·ï¼</text> |
| | | <text class="value">{{item.lotNo}}</text> |
| | | </view> |
| | | <view class="info-row"> |
| | | <text class="label">æ°éï¼</text> |
| | | <text class="value">{{item.quantity}}</text> |
| | | </view> |
| | | <view class="info-row"> |
| | | <text class="label">çäº§æ¥æï¼</text> |
| | | <text class="value">{{item.productionDate}}</text> |
| | | </view> |
| | | <view class="info-row"> |
| | | <text class="label">æææï¼</text> |
| | | <text class="value">{{item.effectiveDate}}</text> |
| | | </view> |
| | | <view class="info-row"> |
| | | <text class="label">ç©æé¿åº¦ï¼</text> |
| | | <text class="value">{{item.materielLength}}</text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | </uni-list-item> |
| | | </uni-list> |
| | | </view> |
| | | |
| | | <!-- ç©ºç¶ææç¤º --> |
| | | <view class="empty-state" v-if="matInfos.length === 0 && barcode"> |
| | | <uni-icons type="empty" size="60" color="#ccc"></uni-icons> |
| | | <text class="empty-text">ææ ç©æä¿¡æ¯ï¼è¯·æ«æå
ç®±æ ç¾</text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | |
| | | <u-toast ref="uToast" /> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | const innerAudioContext = uni.createInnerAudioContext(); |
| | | export default { |
| | | data() { |
| | | return { |
| | | // æ ç¾é¡µé
ç½® |
| | | items: ['çæPPæ¬è¿ä»»å¡'], |
| | | current: 0, |
| | | // è¡¨åæ°æ® |
| | | barcode: "", // æçæ¡ç |
| | | startPoint: "", // èµ·å§å°å |
| | | materSn: "", // å
ç®±æ ç¾åå§è¾å
¥ |
| | | Initiallife: 1000, // ç¹æ®ä»åºå段ï¼å¯¿å½/æ°éï¼ |
| | | // å
ç®±ç è§£æç»æ |
| | | matInfos: [], // ç©æä¿¡æ¯ï¼å½åä»
ä¿ç䏿¡ï¼ |
| | | sns: [], // åºåå·æ°ç»ï¼ç¨äºæäº¤ï¼ |
| | | // ç¦ç¹æ§å¶ï¼å®ç°PDAæ«æèªå¨è·³è½¬ï¼ |
| | | barcodeFocus: true, // æçæ¡ç è¾å
¥æ¡ç¦ç¹ |
| | | startPointFocus: false,// èµ·å§å°åè¾å
¥æ¡ç¦ç¹ |
| | | materSnFocus: false, // å
ç®±æ ç¾è¾å
¥æ¡ç¦ç¹ |
| | | // ç¹æ®ä»åºæ è¯ |
| | | Test: false, |
| | | Testlabel: "", |
| | | Testplaceholder: "", |
| | | Testcheck: false, |
| | | // å
¶ä»è¾
婿°æ® |
| | | orderNo: "", |
| | | warehouseId: "", |
| | | orderInfo: [], |
| | | // é²éå¤æäº¤æ è¯ |
| | | isSubmitting: false |
| | | } |
| | | }, |
| | | onLoad(res) { |
| | | // æ¥æ¶é¡µé¢åæ° |
| | | this.orderNo = res.orderNo; |
| | | this.warehouseId = res.warehouseId; |
| | | |
| | | // ç¹æ®ä»åºé»è¾ï¼æµè¯æ¶ä»åº(6) æ æ²¹å¢¨ä»åº(2) |
| | | if (this.warehouseId == 6) { |
| | | this.Test = true; |
| | | this.Testlabel = "åå§å¯¿å½:"; |
| | | this.Testplaceholder = "请è¾å
¥åå§å¯¿å½"; |
| | | } else if (this.warehouseId == 2) { |
| | | this.Test = true; |
| | | this.Testlabel = "æ°é:"; |
| | | this.Testplaceholder = "请è¾å
¥æ°é"; |
| | | this.Initiallife = 16; |
| | | } |
| | | |
| | | // å è½½åæ®ä¿¡æ¯ |
| | | this.getData(); |
| | | }, |
| | | onReady() { |
| | | // ç¡®ä¿é¡µé¢å è½½åæçç è¾å
¥æ¡è·å¾ç¦ç¹ï¼PDAèªå¨èç¦ï¼ |
| | | this.barcodeFocus = true; |
| | | this.startPointFocus = false; |
| | | this.materSnFocus = false; |
| | | }, |
| | | methods: { |
| | | // ==================== æ°æ®è·å ==================== |
| | | getData() { |
| | | var postData = { |
| | | MainData: { |
| | | orderNo: this.orderNo |
| | | }, |
| | | } |
| | | this.$u.post('/api/InboundOrderDetail/GetInboundOrderDetails', postData).then((res) => { |
| | | if (res.status) { |
| | | this.orderInfo = res.data; |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | // ==================== æ ç¾é¡µåæ¢ ==================== |
| | | onClickItem(e) { |
| | | if (this.current !== e.currentIndex) { |
| | | this.current = e.currentIndex; |
| | | } |
| | | }, |
| | | |
| | | // ==================== ç¦ç¹è·³è½¬æ ¸å¿é»è¾ ==================== |
| | | /** |
| | | * æçæ¡ç æ«æç¡®è®¤ |
| | | * PDAæ«æåèªå¨å车触åï¼æ ¡éªé空å跳转ç¦ç¹å°èµ·å§å°å |
| | | */ |
| | | onBarcodeConfirm() { |
| | | if (!this.barcode || this.barcode.trim() === '') { |
| | | this.$refs.uToast.show({ |
| | | title: "è¯·æ«ææçæ¡ç ", |
| | | type: 'error' |
| | | }); |
| | | // ä¿æç¦ç¹å¨æçæ¡ç æ¡ï¼çå¾
éæ°æ«æ |
| | | this.barcodeFocus = true; |
| | | this.startPointFocus = false; |
| | | this.materSnFocus = false; |
| | | return; |
| | | } |
| | | // æçç ææï¼è·³è½¬ç¦ç¹å°èµ·å§å°åè¾å
¥æ¡ |
| | | this.barcodeFocus = false; |
| | | this.startPointFocus = true; |
| | | this.materSnFocus = false; |
| | | }, |
| | | |
| | | /** |
| | | * èµ·å§å°åæ«æç¡®è®¤ |
| | | * PDAæ«æåèªå¨å车触åï¼æ ¡éªé空å跳转ç¦ç¹å°å
ç®±æ ç¾ |
| | | */ |
| | | onStartPointConfirm() { |
| | | if (!this.startPoint || this.startPoint.trim() === '') { |
| | | this.$refs.uToast.show({ |
| | | title: "è¯·æ«æèµ·å§å°å", |
| | | type: 'error' |
| | | }); |
| | | // ä¿æç¦ç¹å¨èµ·å§å°åæ¡ |
| | | this.barcodeFocus = false; |
| | | this.startPointFocus = true; |
| | | this.materSnFocus = false; |
| | | return; |
| | | } |
| | | // èµ·å§å°åææï¼è·³è½¬ç¦ç¹å°å
ç®±æ ç¾è¾å
¥æ¡ |
| | | this.barcodeFocus = false; |
| | | this.startPointFocus = false; |
| | | this.materSnFocus = true; |
| | | }, |
| | | |
| | | /** |
| | | * å
ç®±æ ç¾æ«æç¡®è®¤ |
| | | * PDAæ«æåèªå¨å车触åï¼è§£æå
ç®±ç ï¼ä¸èªå¨è·³è½¬ç¦ç¹ï¼åçå¨å
ç®±ç æ¡ï¼æ¹ä¾¿è¦çæ«æï¼ |
| | | * 注æï¼å¿
é¡»çå¾
è¾å
¥æ¡å
容宿´åå车æè§¦åï¼ç¬¦åPDAæ«æä¹ æ¯ |
| | | */ |
| | | onMaterSnConfirm() { |
| | | if (!this.materSn || this.materSn.trim() === '') { |
| | | this.$refs.uToast.show({ |
| | | title: "è¯·æ«æå
ç®±æ ç¾", |
| | | type: 'error' |
| | | }); |
| | | // ä¿æç¦ç¹å¨å
ç®±ç æ¡ |
| | | return; |
| | | } |
| | | |
| | | // ç¹æ®å¤çï¼ä»åº11æ¶å»æåç¼ |
| | | let snToProcess = this.materSn; |
| | | if (this.warehouseId == 11) { |
| | | snToProcess = snToProcess.replace(/,SC.*/, ''); |
| | | } |
| | | |
| | | // å
ç®±ç æ ¼å¼æ ¡éªï¼å¿
é¡»å
å«7ä¸ªåæ®µï¼ä»¥éå·åéï¼ |
| | | if (snToProcess.split(',').length != 7) { |
| | | this.$refs.uToast.show({ |
| | | title: "å
ç®±ç æ ¼å¼é误ï¼è¯·éæ°æ«æ", |
| | | type: 'error' |
| | | }); |
| | | // æ¸
空è¾å
¥æ¡ï¼ä¾¿äºéæ°æ«æ |
| | | this.materSn = ""; |
| | | // ä¿æç¦ç¹ |
| | | return; |
| | | } |
| | | |
| | | // åèµ·å端解æè¯·æ± |
| | | this.$u.post('/api/MaterielInfo/PPPKCodeAnalysis?serNum=' + snToProcess, {}) |
| | | .then(res => { |
| | | if (res.status) { |
| | | // è§£ææåï¼æ¿æ¢ä¸ºææ°çå
ç®±ç ï¼åªä¿çä¸ä¸ªï¼ |
| | | this.sns = [res.data.serialNumber]; |
| | | this.matInfos = [res.data]; |
| | | |
| | | this.$refs.uToast.show({ |
| | | title: "å
ç®±ç å·²æ´æ°", |
| | | type: "success", |
| | | duration: 1500 |
| | | }); |
| | | // æ¸
空è¾å
¥æ¡ï¼ä¸ºä¸ä¸æ¬¡æ«æååå¤ï¼ç¦ç¹ä»å¨å
ç®±ç æ¡ï¼ |
| | | this.materSn = ""; |
| | | // ç¦ç¹ä¸å¨ï¼ä¿æå¨å
ç®±ç æ¡ï¼materSnFocus å·²æ¯ trueï¼ |
| | | } else { |
| | | this.$refs.uToast.show({ |
| | | title: res.message, |
| | | type: "error" |
| | | }); |
| | | // è§£æå¤±è´¥ï¼æ¸
空è¾å
¥æ¡ï¼è®©ç¨æ·éæ°æ«æ |
| | | this.materSn = ""; |
| | | } |
| | | }) |
| | | .catch(err => { |
| | | this.$refs.uToast.show({ |
| | | title: err.message || "è§£æå¤±è´¥", |
| | | type: "error" |
| | | }); |
| | | this.materSn = ""; |
| | | }); |
| | | }, |
| | | |
| | | // ==================== è¾
å©æä½ ==================== |
| | | /** |
| | | * æ¸
空å½åå
ç®±ç æ°æ® |
| | | */ |
| | | clearSn() { |
| | | this.matInfos = []; |
| | | this.sns = []; |
| | | this.materSn = ""; |
| | | this.$refs.uToast.show({ |
| | | title: "å
ç®±ç å·²æ¸
空", |
| | | type: "info" |
| | | }); |
| | | // æ¸
空åç¦ç¹ä»å¯çå¨å
ç®±ç æ¡ï¼æ¹ä¾¿éæ°æ«æï¼ä¸è·³è½¬ï¼ |
| | | }, |
| | | |
| | | /** |
| | | * å é¤å表项ï¼å®é
乿¯æ¸
空å
ç®±ç ï¼ |
| | | */ |
| | | deleteList(index) { |
| | | this.matInfos = []; |
| | | this.sns = []; |
| | | this.materSn = ""; |
| | | this.$refs.uToast.show({ |
| | | title: "å
ç®±ç 已移é¤", |
| | | type: "info" |
| | | }); |
| | | }, |
| | | |
| | | // ==================== çæPPæ¬è¿ä»»å¡ ==================== |
| | | generatePPTask() { |
| | | // åºç¡æ ¡éª |
| | | if (!this.barcode) { |
| | | this.$refs.uToast.show({ |
| | | title: "è¯·æ«ææçæ¡ç ", |
| | | type: 'error' |
| | | }); |
| | | // ç¦ç¹è·³è½¬å°æçæ¡ç æ¡ |
| | | this.resetFocusToBarcode(); |
| | | return; |
| | | } |
| | | if (!this.startPoint) { |
| | | this.$refs.uToast.show({ |
| | | title: "è¯·æ«æèµ·å§å°å", |
| | | type: 'error' |
| | | }); |
| | | this.resetFocusToStartPoint(); |
| | | return; |
| | | } |
| | | if (this.matInfos.length === 0) { |
| | | this.$refs.uToast.show({ |
| | | title: "è¯·æ«æå
ç®±æ ç¾", |
| | | type: 'error' |
| | | }); |
| | | this.resetFocusToMaterSn(); |
| | | return; |
| | | } |
| | | |
| | | // ç¹æ®ä»åºåæ®µæ ¡éªï¼æµè¯æ¶/æ²¹å¢¨ï¼ |
| | | if (this.Test) { |
| | | if (!this.Testcheck) { |
| | | this.Testcheck = true; |
| | | if (this.warehouseId == 2) { |
| | | this.$refs.uToast.show({ |
| | | title: "请确认æ°é", |
| | | type: 'error' |
| | | }); |
| | | } else if (this.warehouseId == 6) { |
| | | this.$refs.uToast.show({ |
| | | title: "请确认åå§å¯¿å½", |
| | | type: 'error' |
| | | }); |
| | | } |
| | | return; |
| | | } |
| | | } |
| | | |
| | | // 油墨ä»åºæ°éå¤çï¼å¤å¶åºåå· |
| | | if (this.warehouseId == 2) { |
| | | const baseSn = this.sns[0]; |
| | | for (let i = 0; i < this.Initiallife - 1; i++) { |
| | | this.sns.push(baseSn); |
| | | } |
| | | } |
| | | |
| | | // é²éå¤æäº¤ |
| | | if (this.isSubmitting) return; |
| | | this.isSubmitting = true; |
| | | |
| | | // æäº¤ä»»å¡ |
| | | let url = 'palletCode=' + this.barcode + '&startPoint=' + this.startPoint + '&warehouseId=' + this.warehouseId; |
| | | this.$u.post('/api/Mes/PPTaskMove?' + url, this.sns) |
| | | .then(res => { |
| | | this.Testcheck = false; |
| | | if (res.status) { |
| | | this.$refs.uToast.show({ |
| | | title: "PPæ¬è¿ä»»å¡çææå", |
| | | type: "success" |
| | | }); |
| | | // éç½®è¡¨åæææ°æ® |
| | | this.barcode = ""; |
| | | this.startPoint = ""; |
| | | this.materSn = ""; |
| | | this.matInfos = []; |
| | | this.sns = []; |
| | | // éç½®ç¦ç¹ï¼åå°æçæ¡ç æ¡ï¼å¼å§æ°çä¸è½®æ«æ |
| | | this.resetFocusToBarcode(); |
| | | } else { |
| | | this.$refs.uToast.show({ |
| | | title: res.message, |
| | | type: "error" |
| | | }); |
| | | } |
| | | }) |
| | | .catch(err => { |
| | | this.$refs.uToast.show({ |
| | | title: err.message || "请æ±å¤±è´¥", |
| | | type: "error" |
| | | }); |
| | | }) |
| | | .finally(() => { |
| | | this.isSubmitting = false; |
| | | }); |
| | | }, |
| | | |
| | | // ==================== ç¦ç¹éç½®è¾
婿¹æ³ ==================== |
| | | resetFocusToBarcode() { |
| | | this.barcodeFocus = true; |
| | | this.startPointFocus = false; |
| | | this.materSnFocus = false; |
| | | }, |
| | | resetFocusToStartPoint() { |
| | | this.barcodeFocus = false; |
| | | this.startPointFocus = true; |
| | | this.materSnFocus = false; |
| | | }, |
| | | resetFocusToMaterSn() { |
| | | this.barcodeFocus = false; |
| | | this.startPointFocus = false; |
| | | this.materSnFocus = true; |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss"> |
| | | @import '@/common/uni-ui.scss'; |
| | | |
| | | page { |
| | | background-color: #f5f7fa; |
| | | font-size: 14px; |
| | | color: #333; |
| | | } |
| | | |
| | | .page-container { |
| | | min-height: 100vh; |
| | | display: flex; |
| | | flex-direction: column; |
| | | } |
| | | |
| | | .nav-header { |
| | | background-color: #fff; |
| | | padding: 12px 16px; |
| | | box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05); |
| | | |
| | | .segmented-control { |
| | | --uni-segmented-control-border-color: #e5e7eb; |
| | | --uni-segmented-control-bg-color: #f9fafb; |
| | | --uni-segmented-control-active-color: #165dff; |
| | | --uni-segmented-control-inactive-color: #666; |
| | | --uni-segmented-control-height: 40px; |
| | | border-radius: 8px; |
| | | } |
| | | } |
| | | |
| | | .main-content { |
| | | flex: 1; |
| | | padding: 16px; |
| | | } |
| | | |
| | | .card-container { |
| | | display: flex; |
| | | flex-direction: column; |
| | | gap: 16px; |
| | | } |
| | | |
| | | .form-card { |
| | | background-color: #fff; |
| | | border-radius: 12px; |
| | | padding: 20px; |
| | | box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04); |
| | | } |
| | | |
| | | .form-item { |
| | | margin-bottom: 16px; |
| | | |
| | | &:last-of-type { |
| | | margin-bottom: 24px; |
| | | } |
| | | } |
| | | |
| | | .input-field { |
| | | --uni-easyinput-border-color: #e5e7eb; |
| | | --uni-easyinput-bg-color: #f9fafb; |
| | | --uni-easyinput-input-color: #333; |
| | | --uni-easyinput-placeholder-color: #9ca3af; |
| | | border-radius: 8px; |
| | | padding: 10px 12px; |
| | | height: 44px; |
| | | transition: all 0.2s ease; |
| | | |
| | | &:focus { |
| | | --uni-easyinput-border-color: #165dff; |
| | | box-shadow: 0 0 0 2px rgba(22, 93, 255, 0.1); |
| | | } |
| | | } |
| | | |
| | | .selected-tip { |
| | | display: flex; |
| | | align-items: center; |
| | | margin-top: 8px; |
| | | padding: 6px 10px; |
| | | background-color: #f0f7ff; |
| | | border-radius: 6px; |
| | | |
| | | .tip-text { |
| | | font-size: 12px; |
| | | color: #6b7280; |
| | | margin-right: 6px; |
| | | } |
| | | |
| | | .sn-text { |
| | | flex: 1; |
| | | font-size: 12px; |
| | | color: #165dff; |
| | | font-weight: 500; |
| | | overflow: hidden; |
| | | text-overflow: ellipsis; |
| | | white-space: nowrap; |
| | | } |
| | | |
| | | .clear-icon { |
| | | color: #94a3b8; |
| | | margin-left: 6px; |
| | | transition: color 0.2s ease; |
| | | |
| | | &:active { |
| | | color: #ef4444; |
| | | } |
| | | } |
| | | } |
| | | |
| | | .form-actions { |
| | | display: flex; |
| | | justify-content: center; |
| | | } |
| | | |
| | | .btn-primary { |
| | | --button-primary-background-color: #165dff; |
| | | --button-primary-border-color: #165dff; |
| | | --button-primary-text-color: #fff; |
| | | --button-disabled-background-color: #94a3b8; |
| | | --button-disabled-border-color: #94a3b8; |
| | | border-radius: 8px; |
| | | width: 100%; |
| | | height: 48px; |
| | | font-size: 16px; |
| | | font-weight: 500; |
| | | box-shadow: 0 4px 12px rgba(22, 93, 255, 0.2); |
| | | transition: all 0.2s ease; |
| | | |
| | | &:not([disabled]):active { |
| | | transform: translateY(1px); |
| | | box-shadow: 0 2px 8px rgba(22, 93, 255, 0.2); |
| | | } |
| | | } |
| | | |
| | | .list-card { |
| | | background-color: #fff; |
| | | border-radius: 12px; |
| | | box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04); |
| | | overflow: hidden; |
| | | } |
| | | |
| | | .list-header { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | padding: 16px 20px; |
| | | border-bottom: 1px solid #f0f0f0; |
| | | |
| | | .list-title { |
| | | font-size: 16px; |
| | | font-weight: 600; |
| | | color: #1f2937; |
| | | } |
| | | |
| | | .count-badge { |
| | | background-color: #e6f4ff; |
| | | color: #165dff; |
| | | padding: 2px 8px; |
| | | border-radius: 100px; |
| | | font-size: 12px; |
| | | font-weight: 500; |
| | | } |
| | | } |
| | | |
| | | .material-list { |
| | | --uni-list-item-border-color: #f9fafb; |
| | | } |
| | | |
| | | .list-item { |
| | | padding: 0; |
| | | |
| | | &:last-child { |
| | | --uni-list-item-border-color: transparent; |
| | | } |
| | | } |
| | | |
| | | .list-item-content { |
| | | position: relative; |
| | | padding: 16px 20px; |
| | | } |
| | | |
| | | .delete-icon { |
| | | position: absolute; |
| | | right: 20px; |
| | | top: 50%; |
| | | transform: translateY(-50%); |
| | | color: #ef4444; |
| | | transition: all 0.2s ease; |
| | | |
| | | &:active { |
| | | transform: translateY(-50%) scale(0.95); |
| | | } |
| | | } |
| | | |
| | | .info-grid { |
| | | display: grid; |
| | | grid-template-columns: repeat(2, 1fr); |
| | | gap: 8px 16px; |
| | | } |
| | | |
| | | .info-row { |
| | | display: flex; |
| | | flex-direction: column; |
| | | |
| | | .label { |
| | | font-size: 12px; |
| | | color: #6b7280; |
| | | margin-bottom: 2px; |
| | | } |
| | | |
| | | .value { |
| | | font-size: 14px; |
| | | color: #1f2937; |
| | | font-weight: 500; |
| | | } |
| | | } |
| | | |
| | | .empty-state { |
| | | display: flex; |
| | | flex-direction: column; |
| | | align-items: center; |
| | | justify-content: center; |
| | | padding: 48px 20px; |
| | | background-color: #fff; |
| | | border-radius: 12px; |
| | | box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04); |
| | | |
| | | .empty-text { |
| | | margin-top: 16px; |
| | | font-size: 14px; |
| | | color: #9ca3af; |
| | | } |
| | | } |
| | | </style> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | </template> |
| | | |
| | | <script> |
| | | </script> |
| | | |
| | | <style> |
| | | </style> |
| | |
| | | @input="addressInput" /> |
| | | </uni-forms-item> |
| | | <uni-forms-item> |
| | | <button @click="InEmpty" type="primary" size="default" style="margin-top: 2%;">空æ¡ååº</button> |
| | | <!-- 空æ¡ååºæé®æ·»å ç¦ç¨ç¶æåæåæç¤º --> |
| | | <button |
| | | @click="InEmpty" |
| | | type="primary" |
| | | size="default" |
| | | style="margin-top: 2%;" |
| | | :disabled="isSubmitting" |
| | | > |
| | | {{ isSubmitting ? 'æäº¤ä¸...' : '空æ¡ååº' }} |
| | | </button> |
| | | </uni-forms-item> |
| | | </uni-forms> |
| | | </view> |
| | |
| | | focusStart:false, |
| | | barcode: "", |
| | | address: "", |
| | | WarehouseId: "" |
| | | WarehouseId: "", |
| | | // æ°å¢ï¼é²éå¤ç¹å»ç¶æåé |
| | | isSubmitting: false |
| | | } |
| | | }, |
| | | onShow() {}, |
| | |
| | | |
| | | }, |
| | | methods: { |
| | | // voiceSpeech(src) { |
| | | // innerAudioContext.src = src; // '../../static/success.mp3'; |
| | | // innerAudioContext.play(); |
| | | // }, |
| | | barcodeInput() { |
| | | this.$nextTick(function(x) { |
| | | if (this.barcode.length > 0) { |
| | |
| | | }) |
| | | }, |
| | | InEmpty() { |
| | | // 1. åç½®æ ¡éª |
| | | if (this.barcode == "") { |
| | | this.$refs.uToast.show({ |
| | | title: "è¯·æ«ææçç ", |
| | |
| | | }) |
| | | return; |
| | | } |
| | | |
| | | // 2. 鲿¢éå¤ç¹å»ï¼è¯·æ±ä¸åç´æ¥è¿å |
| | | if (this.isSubmitting) return; |
| | | |
| | | // 3. æ 记为请æ±ä¸ï¼ç¦ç¨æé® |
| | | this.isSubmitting = true; |
| | | |
| | | this.$u.post('/api/Task/EmptyBackTask?barcode=' + this.barcode + '&startPoint=' + this.address).then( |
| | | res => { |
| | | if (res.status) { |
| | |
| | | type: "error" |
| | | }) |
| | | } |
| | | }).catch(err => { |
| | | // æè·è¯·æ±å¼å¸¸ï¼æç¤ºé误 |
| | | this.$refs.uToast.show({ |
| | | title: err.message || "请æ±å¤±è´¥", |
| | | type: "error" |
| | | }) |
| | | }).finally(() => { |
| | | // 4. 请æ±å®æï¼æå/失败/å¼å¸¸ï¼æ¢å¤æé®ç¶æ |
| | | this.isSubmitting = false; |
| | | }) |
| | | } |
| | | } |
| | |
| | | <uni-easyinput type="text" :placeholder="Testplaceholder" ref='midInput' |
| | | v-model="Initiallife" /> |
| | | </uni-forms-item> |
| | | <!-- <uni-forms-item> |
| | | <checkbox checked="check">æ¯å¦æ»¡ç</checkbox> |
| | | </uni-forms-item> --> |
| | | <uni-forms-item> |
| | | <button @click="submit" type="primary" size="default" style="margin-top: 2%;">ç»ç</button> |
| | | <!-- ç»çæé®æ·»å ç¦ç¨ç¶æ --> |
| | | <button |
| | | @click="submit" |
| | | type="primary" |
| | | size="default" |
| | | style="margin-top: 2%;" |
| | | :disabled="isSubmitting" |
| | | > |
| | | {{ isSubmitting ? 'ç»çä¸...' : 'ç»ç' }} |
| | | </button> |
| | | </uni-forms-item> |
| | | </uni-forms> |
| | | <uni-list> |
| | | <!-- <uni-list-item direction="column" v-for="item in matTotal" :key="item.matCode"> |
| | | <template v-slot:body> |
| | | <view class="uni-list-box"> |
| | | <view class="uni-content"> |
| | | <view class="uni-title-sub uni-ellipsis-2">ç©æç¼ç ï¼{{item.matCode}}</view> |
| | | <view class="uni-title-sub uni-ellipsis-2">æ°éï¼{{item.matQuantity}}</view> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | </uni-list-item> --> |
| | | <uni-list-item direction="column" v-for="(item,index) in matInfos" :key="index"> |
| | | <template v-slot:body> |
| | | <view class="uni-list-box"> |
| | |
| | | placeholder="è¯·æ«æå°åæ¡ç " ref='midInput' :focus="addressFocus" /> |
| | | </uni-forms-item> |
| | | <uni-forms-item> |
| | | <button @click="inbound" type="primary" size="default" style="margin-top: 2%;">å
¥åºç¡®è®¤</button> |
| | | <!-- å
¥åºæé®æ·»å ç¦ç¨ç¶æ --> |
| | | <button |
| | | @click="inbound" |
| | | type="primary" |
| | | size="default" |
| | | style="margin-top: 2%;" |
| | | :disabled="isInbounding" |
| | | > |
| | | {{ isInbounding ? 'å
¥åºä¸...' : 'å
¥åºç¡®è®¤' }} |
| | | </button> |
| | | </uni-forms-item> |
| | | </uni-forms> |
| | | </view> |
| | |
| | | addressdisabled: false, |
| | | pksns: [], |
| | | pkmaterSn: "", |
| | | pkmatInfos: [] |
| | | pkmatInfos: [], |
| | | // æ°å¢ï¼ç»ç请æ±ç¶æï¼é²æ¢éå¤ç¹å»ï¼ |
| | | isSubmitting: false, |
| | | // æ°å¢ï¼å
¥åºè¯·æ±ç¶æï¼é²æ¢éå¤ç¹å»ï¼ |
| | | isInbounding: false |
| | | } |
| | | }, |
| | | onShow() {}, |
| | |
| | | }) |
| | | }, |
| | | inbound() { |
| | | // 1. åç½®æ ¡éª |
| | | if (this.inboundBarcode == "") { |
| | | this.$refs.uToast.show({ |
| | | title: "è¯·æ«ææçæ¡ç ", |
| | |
| | | }) |
| | | return; |
| | | } |
| | | |
| | | // 2. 鲿¢éå¤ç¹å»ï¼å¦ææ£å¨è¯·æ±ï¼ç´æ¥è¿å |
| | | if (this.isInbounding) return; |
| | | |
| | | // 3. æ 记为请æ±ä¸ï¼ç¦ç¨æé® |
| | | this.isInbounding = true; |
| | | |
| | | var postData = { |
| | | MainData: { |
| | | "barcode": this.inboundBarcode, |
| | |
| | | title: err.message, |
| | | type: "error" |
| | | }) |
| | | }).finally(() => { |
| | | // 4. 请æ±å®æï¼æå/失败ï¼åï¼æ¢å¤æé®ç¶æ |
| | | this.isInbounding = false; |
| | | }) |
| | | }, |
| | | inputChangebarcode() { |
| | |
| | | this.sns.splice(res, 1); |
| | | }, |
| | | submit() { |
| | | // 1. åç½®æ ¡éª |
| | | if (this.barcode == "") { |
| | | this.$refs.uToast.show({ |
| | | title: "è¯·æ«ææçæ¡ç ", |
| | |
| | | return; |
| | | } |
| | | } |
| | | |
| | | // 2. 鲿¢éå¤ç¹å»ï¼å¦ææ£å¨è¯·æ±ï¼ç´æ¥è¿å |
| | | if (this.isSubmitting) return; |
| | | |
| | | // 3. æ 记为请æ±ä¸ï¼ç¦ç¨æé® |
| | | this.isSubmitting = true; |
| | | |
| | | if (this.warehouseId == 2) { //油墨ä»åºåºID |
| | | this.sn = this.sns[0]; |
| | | for (var i = 0; i < this.Initiallife - 1; i++) { |
| | |
| | | type: "error" |
| | | }) |
| | | } |
| | | }).finally(() => { |
| | | // 4. 请æ±å®æï¼æå/失败ï¼åï¼æ¢å¤æé®ç¶æ |
| | | this.isSubmitting = false; |
| | | }) |
| | | } |
| | | } |
| | |
| | | v-model="Initiallife" /> |
| | | </uni-forms-item> |
| | | |
| | | <!-- <uni-forms-item> |
| | | <checkbox checked="check">æ¯å¦æ»¡ç</checkbox> |
| | | </uni-forms-item> --> |
| | | <uni-forms-item> |
| | | <view style="display: flex;justify-content: space-around;margin-top: 2%;"> |
| | | <button @click="reset" type="default" size="default" |
| | | style="width: 160rpx;border: 1rpx solid #007aff;color: #007aff;">éç½®</button> |
| | | <button @click="submit" type="primary" size="default" style="width: 160rpx;">ç»ç</button> |
| | | <!-- ç»çæé®æ·»å ç¦ç¨ç¶æåæåæç¤º --> |
| | | <button @click="submit" type="primary" size="default" style="width: 160rpx;" |
| | | :disabled="isSubmitting"> |
| | | {{ isSubmitting ? 'ç»çä¸...' : 'ç»ç' }} |
| | | </button> |
| | | </view> |
| | | </uni-forms-item> |
| | | </uni-forms> |
| | | <uni-list> |
| | | <!-- <uni-list-item direction="column" v-for="item in matTotal" :key="item.matCode"> |
| | | <template v-slot:body> |
| | | <view class="uni-list-box"> |
| | | <view class="uni-content"> |
| | | <view class="uni-title-sub uni-ellipsis-2">ç©æç¼ç ï¼{{item.matCode}}</view> |
| | | <view class="uni-title-sub uni-ellipsis-2">æ°éï¼{{item.matQuantity}}</view> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | </uni-list-item> --> |
| | | <uni-list-item direction="column" v-for="(item,index) in matInfos" :key="index"> |
| | | <template v-slot:body> |
| | | <view class="uni-list-box"> |
| | |
| | | placeholder="è¯·æ«æå°åæ¡ç " ref='midInput' :focus="addressFocus" /> |
| | | </uni-forms-item> |
| | | <uni-forms-item> |
| | | <button @click="inbound" type="primary" size="default" style="margin-top: 2%;">å
¥åºç¡®è®¤</button> |
| | | <!-- å
¥åºç¡®è®¤æé®æ·»å ç¦ç¨ç¶æåæåæç¤º --> |
| | | <button @click="inbound" type="primary" size="default" style="margin-top: 2%;" |
| | | :disabled="isInbounding"> |
| | | {{ isInbounding ? 'å
¥åºä¸...' : 'å
¥åºç¡®è®¤' }} |
| | | </button> |
| | | </uni-forms-item> |
| | | </uni-forms> |
| | | </view> |
| | |
| | | <view style="font-size: 18px;">ç©æç¼ç ï¼{{item.materielCode}}</view> |
| | | <view>ç©æåç§°ï¼{{item.materielName}}</view> |
| | | <view>ç©æè§æ ¼ï¼{{item.materielSpec}}</view> |
| | | <!-- <view style="font-size: 18px;">ç©æåç§°ï¼{{item.matName}}</view> --> |
| | | <view style="font-size: 18px;">æ°éï¼{{item.orderQuantity+item.unit}}</view> |
| | | <view style="font-size: 18px;">ç»çæ°éï¼{{item.receiptQuantity}}</view> |
| | | </view> |
| | |
| | | <view style="display: flex;justify-content: space-around;margin-top: 2%;"> |
| | | <button @click="resetInPk" type="default" size="default" |
| | | style="width: 160rpx;border: 1rpx solid #007aff;color: #007aff;">éç½®</button> |
| | | <!-- å
¥å¹³åºæé®æ·»å ç¦ç¨ç¶æåæåæç¤º --> |
| | | <button @click="pksubmit" type="primary" size="default" |
| | | style="margin-top: 2%;">å
¥å¹³åº</button> |
| | | style="margin-top: 2%;" :disabled="isPkSubmitting"> |
| | | {{ isPkSubmitting ? 'å
¥åºä¸...' : 'å
¥å¹³åº' }} |
| | | </button> |
| | | </view> |
| | | </uni-forms-item> |
| | | |
| | |
| | | Testcheck: false, |
| | | pkmaterSn: "", |
| | | pkmatInfos: [], |
| | | addressdisabled: false |
| | | addressdisabled: false, |
| | | // æ°å¢ï¼é²éå¤ç¹å»ç¶æåé |
| | | isSubmitting: false, // ç»ç请æ±ç¶æ |
| | | isInbounding: false, // å
¥åºç¡®è®¤è¯·æ±ç¶æ |
| | | isPkSubmitting: false // å
¥å¹³åºè¯·æ±ç¶æ |
| | | } |
| | | }, |
| | | onShow() {}, |
| | |
| | | this.getData(); |
| | | }, |
| | | methods: { |
| | | // voiceSpeech(src) { |
| | | // innerAudioContext.src = src; // '../../static/success.mp3'; |
| | | // innerAudioContext.play(); |
| | | // }, |
| | | updateFocus() { |
| | | debugger |
| | | this.$nextTick(() => { |
| | |
| | | barcodeInput() { |
| | | this.$nextTick(function(x) { |
| | | if (this.barcode.length > 0) { |
| | | // if (this.barcode.substring(0, 1) == 'A' || this.barcode.substring(0, 2) == 'TP') { |
| | | this.focus = true; |
| | | // } else { |
| | | // this.$refs.uToast.show({ |
| | | // title: "æ«ç é误,è¯·æ«ææçç ", |
| | | // type: "error" |
| | | // }) |
| | | // } |
| | | } |
| | | }) |
| | | }, |
| | |
| | | this.Testcheck = false; |
| | | if (res.status) { |
| | | this.sns.push(res.data.serialNumber); |
| | | |
| | | this.matInfos.push(res.data); |
| | | if (res.message) { |
| | | this.$refs.uToast.show({ |
| | | title: res.message, |
| | | type: "error" |
| | | }) |
| | | // setTimeout(() => { |
| | | // this.voiceSpeech('../../static/fail.mp3'); |
| | | // }, 100); |
| | | return; |
| | | } |
| | | // setTimeout(() => { |
| | | // this.voiceSpeech('../../static/success.mp3'); |
| | | // }, 100); |
| | | } else { |
| | | this.$refs.uToast.show({ |
| | | title: res.message, |
| | | type: "error" |
| | | }) |
| | | // setTimeout(() => { |
| | | // this.voiceSpeech('../../static/fail.mp3'); |
| | | // }, 100); |
| | | } |
| | | }) |
| | | } |
| | |
| | | pksnInput() { |
| | | this.$nextTick(() => { |
| | | if (this.pkmaterSn != "") { |
| | | |
| | | var matSn = this.pkmaterSn; |
| | | |
| | | if(matSn.indexOf("POHA")>0){ |
| | | this.$u.post('/api/MaterielInfo/CodeAnalysis?serNum=' + matSn, {}).then((res) => { |
| | | if (res.status) { |
| | |
| | | title: res.message, |
| | | type: "error" |
| | | }) |
| | | // setTimeout(() => { |
| | | // this.voiceSpeech('../../static/fail.mp3'); |
| | | // }, 100); |
| | | return; |
| | | } |
| | | // setTimeout(() => { |
| | | // this.voiceSpeech('../../static/success.mp3'); |
| | | // }, 100); |
| | | return; |
| | | } else { |
| | | this.$refs.uToast.show({ |
| | | title: res.message, |
| | | type: "error" |
| | | }) |
| | | // setTimeout(() => { |
| | | // this.voiceSpeech('../../static/fail.mp3'); |
| | | // }, 100); |
| | | } |
| | | }) |
| | | } |
| | |
| | | }) |
| | | }, |
| | | inbound() { |
| | | // 1. åç½®æ ¡éª |
| | | if (this.inboundBarcode == "") { |
| | | this.$refs.uToast.show({ |
| | | title: "è¯·æ«ææçæ¡ç ", |
| | |
| | | }) |
| | | return; |
| | | } |
| | | |
| | | // 2. 鲿¢éå¤ç¹å»ï¼è¯·æ±ä¸åç´æ¥è¿å |
| | | if (this.isInbounding) return; |
| | | |
| | | // 3. æ 记为请æ±ä¸ï¼ç¦ç¨æé® |
| | | this.isInbounding = true; |
| | | |
| | | var postData = { |
| | | MainData: { |
| | | "barcode": this.inboundBarcode, |
| | |
| | | title: err.message, |
| | | type: "error" |
| | | }) |
| | | }).finally(() => { |
| | | // 4. 请æ±å®æï¼æå/å¤±è´¥ï¼æ¢å¤æé®ç¶æ |
| | | this.isInbounding = false; |
| | | }) |
| | | }, |
| | | inputChangebarcode() { |
| | |
| | | this.pksns = []; |
| | | }, |
| | | pksubmit() { |
| | | // 1. åç½®æ ¡éª |
| | | if (this.pkmatInfos.length == 0) { |
| | | this.$refs.uToast.show({ |
| | | title: "è¯·æ«æå
ç®±æ ç¾", |
| | |
| | | }) |
| | | return; |
| | | } |
| | | |
| | | // 2. 鲿¢éå¤ç¹å»ï¼è¯·æ±ä¸åç´æ¥è¿å |
| | | if (this.isPkSubmitting) return; |
| | | |
| | | // 3. æ 记为请æ±ä¸ï¼ç¦ç¨æé® |
| | | this.isPkSubmitting = true; |
| | | |
| | | this.$u.post('/api/InboundOrder/InPinKu?warehouseId=' + this.warehouseId + "&orderNo=" + this.orderNo, this |
| | | .pksns).then(res => { |
| | | if (res.status) { |
| | |
| | | type: "error" |
| | | }) |
| | | } |
| | | }).catch(err => { |
| | | this.$refs.uToast.show({ |
| | | title: err.message, |
| | | type: "error" |
| | | }) |
| | | }).finally(() => { |
| | | // 4. 请æ±å®æï¼æå/å¤±è´¥ï¼æ¢å¤æé®ç¶æ |
| | | this.isPkSubmitting = false; |
| | | }) |
| | | }, |
| | | submit() { |
| | | // 1. åç½®æ ¡éª |
| | | if (this.barcode == "") { |
| | | this.$refs.uToast.show({ |
| | | title: "è¯·æ«ææçæ¡ç ", |
| | |
| | | return; |
| | | } |
| | | } |
| | | |
| | | // 2. 鲿¢éå¤ç¹å»ï¼è¯·æ±ä¸åç´æ¥è¿å |
| | | if (this.isSubmitting) return; |
| | | |
| | | // 3. æ 记为请æ±ä¸ï¼ç¦ç¨æé® |
| | | this.isSubmitting = true; |
| | | |
| | | if (this.warehouseId == 2) { //油墨ä»åºåºID |
| | | this.sn = this.sns[0]; |
| | | for (var i = 0; i < this.Initiallife - 1; i++) { |
| | |
| | | "palletCode": this.barcode, |
| | | "orderNo": this.orderNo, |
| | | "initiallife": this.Initiallife, |
| | | // "isFull": this.check |
| | | "warehouseId": this.warehouseId |
| | | }, |
| | | DelKeys: this.sns |
| | |
| | | type: "error" |
| | | }) |
| | | } |
| | | }).catch(err => { |
| | | this.$refs.uToast.show({ |
| | | title: err.message, |
| | | type: "error" |
| | | }) |
| | | }).finally(() => { |
| | | // 4. 请æ±å®æï¼æå/å¤±è´¥ï¼æ¢å¤æé®ç¶æ |
| | | this.isSubmitting = false; |
| | | }) |
| | | } |
| | | } |