Merge branch 'htq20251215' of http://115.159.85.185:8098/r/ZhongRui/ALDbanyunxiangmu into htq20251215
| | |
| | | onClick: function () { |
| | | } |
| | | } |
| | | ,{ |
| | | name: "æ´ååºåº", |
| | | // icon: 'el-icon-upload2', |
| | | class: '', |
| | | value: 'OrderOut', |
| | | type: 'primary', |
| | | onClick: function () { |
| | | } |
| | | } |
| | | ] |
| | | |
| | | export default buttons |
| | |
| | | render(vnode, mountNode); |
| | | } |
| | | }, |
| | | { |
| | | name: 'åæ¹å
¥åº', |
| | | type: 'primary', |
| | | value: 'åæ¹å
¥åº', |
| | | onClick: async function () { |
| | | console.log('åæ¹å
¥åºæé®è¢«ç¹å»ï¼å¼å§æ ¡éª'); |
| | | const selectedRows = this.$refs.table.getSelected(); |
| | | |
| | | // æ ¡éª1ï¼æ¯å¦éä¸è¡ï¼è³å°éæ©ä¸æ¡ï¼ |
| | | if (selectedRows.length === 0) { |
| | | console.log('æ ¡éªä¸éè¿ï¼æªéä¸ä»»ä½åæ®'); |
| | | ElMessage.warning('è¯·éæ©è³å°ä¸æ¡åæ®'); |
| | | return; |
| | | } |
| | | |
| | | // æ¶éææéä¸åæ®çç¼å·ï¼è¿æ»¤æ åæ®å·çå¼å¸¸è¡ï¼ |
| | | const inboundOrderNos = selectedRows |
| | | .filter(row => row.inboundOrderNo) |
| | | .map(row => row.inboundOrderNo); |
| | | |
| | | // æ ¡éª2ï¼æ¯å¦æææåæ®å· |
| | | if (inboundOrderNos.length === 0) { |
| | | console.log('æ ¡éªä¸éè¿ï¼éä¸åæ®æ ææç¼å·'); |
| | | ElMessage.warning('éä¸ç忮䏿 ææç¼å·ï¼è¯·éæ°éæ©'); |
| | | return; |
| | | } |
| | | |
| | | try { |
| | | console.log('åèµ·åæ¹å
¥åºè¯·æ±ï¼åæ°ï¼', { inboundOrderNos}); |
| | | const response = await http.post('/api/InboundOrder/BatchOrderFeedbackToMes', { |
| | | orderNos: inboundOrderNos, |
| | | inout:1 |
| | | }); |
| | | |
| | | const { status, message, data } = response; |
| | | if (status) { |
| | | console.log('åæ¹å
¥åºæåï¼å端è¿åï¼', data); |
| | | ElMessage.success(`åæ¹å
¥åºæåï¼å
±å¤ç${inboundOrderNos.length}æ¡åæ®`); |
| | | this.refresh(); // å
¥åºæååå·æ°å表ï¼å¤ç¨åæé»è¾ï¼ |
| | | } else { |
| | | console.log('åæ¹å
¥åºå¤±è´¥ï¼å端æç¤ºï¼', message); |
| | | ElMessage.error(message || data?.message || 'åæ¹å
¥åºå¤±è´¥'); |
| | | } |
| | | } catch (error) { |
| | | console.error('åæ¹å
¥åºè¯·æ±å¼å¸¸ï¼', error); |
| | | ElMessage.error('ç½ç»å¼å¸¸ææ¥å£é误ï¼è¯·ç¨åéè¯'); |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | name: '空æçå
¥åº', |
| | | type: 'primary', |
| | |
| | | } |
| | | } |
| | | |
| | | let OrderOutBtn = this.buttons.find(x => x.value == 'OrderOut'); |
| | | if (OrderOutBtn) { |
| | | // 1. æ¹ä¸ºç®å¤´å½æ°ï¼ç¡®ä¿thisæåVueç»ä»¶å®ä¾ï¼åæ®é彿°thisæåæé®æ¬èº«ï¼ |
| | | OrderOutBtn.onClick = async () => { |
| | | // ç°å¨thisæ¯Vueç»ä»¶å®ä¾ï¼è½æ£ç¡®è·å$refs |
| | | let rows = this.$refs.table.getSelected(); |
| | | if (rows.length == 0) return this.$error("è¯·éæ©æ°æ®!"); |
| | | if (rows.length > 1) return this.$error("è¯·éæ©ä¸æ¡æ°æ®!"); |
| | | |
| | | // ç¡®ä¿éä¸è¡æidï¼æ ¹æ®å®é
è¡¨æ ¼æ°æ®åæ®µè°æ´ï¼æ¯å¦rows[0].detailIdçï¼ |
| | | const selectedId = rows[0].id || rows[0].detailId; |
| | | if (!selectedId) return this.$error("é䏿°æ®ç¼ºå°å¿
è¦IDåæ®µ!"); |
| | | |
| | | const platformOptions = [ |
| | | { label: "ç«å°2", value: "2-1" }, |
| | | { label: "ç«å°3", value: "3-1" }, |
| | | ]; |
| | | const mountNode = document.createElement("div"); |
| | | document.body.appendChild(mountNode); |
| | | |
| | | const formData = reactive({ |
| | | selectedPlatform: platformOptions[0].value, |
| | | }); |
| | | |
| | | const vnode = createVNode( |
| | | ElDialog, |
| | | { |
| | | title: "åºåºæä½ - éæ©åºåºç«å°", |
| | | width: "500px", |
| | | modelValue: true, |
| | | appendToBody: true, |
| | | "onUpdate:modelValue": (isVisible) => { |
| | | if (!isVisible) { |
| | | render(null, mountNode); |
| | | document.body.removeChild(mountNode); |
| | | } |
| | | }, |
| | | style: { |
| | | padding: "20px 0", |
| | | borderRadius: "8px", |
| | | }, |
| | | }, |
| | | { |
| | | default: () => |
| | | h( |
| | | ElForm, |
| | | { |
| | | model: formData, |
| | | rules: { |
| | | selectedPlatform: [ |
| | | { required: true, message: "è¯·éæ©åºåºç«å°", trigger: "change" }, |
| | | ], |
| | | }, |
| | | ref: "outboundForm", // 表åref |
| | | labelWidth: "100px", |
| | | style: { |
| | | padding: "0 30px", |
| | | }, |
| | | }, |
| | | [ |
| | | h(ElFormItem, { |
| | | label: "åºåºç«å°", |
| | | prop: "selectedPlatform", |
| | | style: { |
| | | marginBottom: "24px", |
| | | }, |
| | | }, [ |
| | | h(ElSelect, { |
| | | placeholder: "è¯·éæ©åºåºç«å°ï¼3-12ï¼", |
| | | modelValue: formData.selectedPlatform, |
| | | "onUpdate:modelValue": (val) => { |
| | | formData.selectedPlatform = val; |
| | | }, |
| | | style: { |
| | | width: "100%", |
| | | height: "40px", |
| | | borderRadius: "4px", |
| | | borderColor: "#dcdfe6", |
| | | }, |
| | | }, platformOptions.map((platform) => |
| | | h(ElOption, { label: platform.label, value: platform.value }) |
| | | )), |
| | | ]), |
| | | h("div", { |
| | | style: { |
| | | textAlign: "right", |
| | | marginTop: "8px", |
| | | paddingRight: "4px", |
| | | }, |
| | | }, [ |
| | | h(ElButton, { |
| | | type: "text", |
| | | onClick: () => { |
| | | render(null, mountNode); |
| | | document.body.removeChild(mountNode); |
| | | ElMessage.info("åæ¶åºåºæä½"); |
| | | }, |
| | | style: { |
| | | marginRight: "8px", |
| | | color: "#606266", |
| | | }, |
| | | }, "åæ¶"), |
| | | h(ElButton, { |
| | | type: "primary", |
| | | onClick: async () => { |
| | | // 2. ç¡®ä¿è¡¨årefå·²æè½½ï¼ç¨nextTické¿å
è·åä¸å°ï¼ |
| | | await this.$nextTick(); |
| | | const formRef = vnode.component.refs.outboundForm; |
| | | |
| | | if (!formRef) { |
| | | ElMessage.error("表ååå§å失败ï¼è¯·éè¯"); |
| | | return; |
| | | } |
| | | |
| | | try { |
| | | await formRef.validate(); |
| | | } catch (err) { |
| | | return; |
| | | } |
| | | var param = rows[0].orderNo; |
| | | const requestParams = { |
| | | detailIds: [], |
| | | outboundTargetLocation: formData.selectedPlatform, |
| | | outboundQuantity: 1, |
| | | operator: this.currentOperator || "admin", |
| | | orderNo: param, |
| | | }; |
| | | |
| | | try { |
| | | |
| | | const x = await this.http.post( |
| | | "api/Outbound/ProcessPickingOutbound", |
| | | requestParams, |
| | | "æ°æ®å¤çä¸" |
| | | ); |
| | | |
| | | if (!x.status) { |
| | | ElMessage.error(x.message || "æä½å¤±è´¥"); |
| | | return; |
| | | } |
| | | |
| | | ElMessage.success("æä½æå"); |
| | | this.showDetialBox = false; |
| | | this.$emit("parentCall", ($vue) => { |
| | | $vue.getData(); |
| | | }); |
| | | } catch (error) { |
| | | // 5. æå¼é误æè·ï¼æ¹ä¾¿è°è¯ |
| | | console.error("åºåºæ¥å£è¯·æ±å¤±è´¥ï¼", error); |
| | | ElMessage.error("请æ±å¤±è´¥ï¼è¯·ç¨åéè¯"); |
| | | } finally { |
| | | // æ 论æå失败ï¼é½å
³éå¼¹çª |
| | | render(null, mountNode); |
| | | document.body.removeChild(mountNode); |
| | | } |
| | | }, |
| | | style: { |
| | | borderRadius: "4px", |
| | | padding: "8px 20px", |
| | | }, |
| | | }, "ç¡®å®åºåº"), |
| | | ]), |
| | | ]), |
| | | } |
| | | ); |
| | | |
| | | vnode.appContext = this.$.appContext; |
| | | render(vnode, mountNode); |
| | | }; |
| | | } |
| | | |
| | | }, |
| | | onInited() { |
| | | //æ¡æ¶åå§åé
ç½®å |
| | |
| | | if (response != null && response.IsSuccess) |
| | | { |
| | | _inboundOrderRepository.Db.Updateable<Dt_InboundOrderDetail>().SetColumns(it => new Dt_InboundOrderDetail { ReturnToMESStatus = 1 }) |
| | | .Where(it => it.OrderId == inboundOrder.Id).ExecuteCommand(); |
| | | .Where(it => it.OrderId == inboundOrder.Id && inbounddetailID.Contains(it.Id)).ExecuteCommand(); |
| | | } |
| | | else |
| | | { |
| | | _inboundOrderRepository.Db.Updateable<Dt_InboundOrderDetail>().SetColumns(it => new Dt_InboundOrderDetail { ReturnToMESStatus = 2 }) |
| | | .Where(it => inbounddetailID.Contains(it.Id)).ExecuteCommand(); |
| | | return content.Error("åä¼ MES失败"); |
| | | } |
| | | } |
| | | else |
| | |
| | | { |
| | | UpdateOutboundOrderStatus(request.OrderNo, OutOrderStatusEnum.åºåºå®æ.ObjToInt()); |
| | | |
| | | if(outboundOrder.OrderType != OutOrderTypeEnum.InternalAllocat.ObjToInt()) |
| | | { |
| | | _feedbackMesService.OutboundFeedback(outboundOrder.OrderNo); |
| | | } |
| | | |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | |
| | | { |
| | | UpdateOutboundOrderStatus(request.OrderNo, OutOrderStatusEnum.åºåºå®æ.ObjToInt()); |
| | | |
| | | if (outboundOrder.OrderType != OutOrderTypeEnum.InternalAllocat.ObjToInt()) |
| | | { |
| | | _feedbackMesService.OutboundFeedback(outboundOrder.OrderNo); |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | |
| | | } |
| | | Dt_OutboundOrder outboundOrder = _outboundOrderService.Db.Queryable<Dt_OutboundOrder>().Where(x => x.OrderNo == stockInfo.Details.FirstOrDefault().OrderNo).Includes(x=>x.Details).First(); |
| | | |
| | | if(outboundOrder.OrderStatus == OutOrderStatusEnum.åºåºå®æ.ObjToInt()) |
| | | { |
| | | ///åè°MES |
| | | HttpResponseResult<MesResponseDTO> httpResponseResult = new HttpResponseResult<MesResponseDTO>(); |
| | | string reqCode = Guid.NewGuid().ToString(); |
| | | string reqTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); |
| | | string requestData = string.Empty; |
| | | List<string> lineNos = new List<string>(); |
| | | if (outboundOrder.OrderStatus == OutOrderStatusEnum.åºåºå®æ.ObjToInt()) |
| | | { |
| | | |
| | | Dt_AllocateOrder allocateOrder = _allocateOrderRepository.QueryFirst(x => x.OrderNo == outboundOrder.OrderNo); |
| | | if (allocateOrder == null) |
| | | { |
| | |
| | | httpResponseResult = _httpClientHelper.Post<MesResponseDTO>(apiUrl, requestData); |
| | | httpResponseResult.ApiUrl = apiUrl; |
| | | } |
| | | bool isSuccess = httpResponseResult.IsSuccess && httpResponseResult.Data.Code == "200"; |
| | | string message = "æå"; |
| | | if (!isSuccess) |
| | | { |
| | | if (!httpResponseResult.IsSuccess) |
| | | { |
| | | message = $"MESæ¥å£è¿åé误ï¼HTTP代ç ï¼{httpResponseResult.StatusCode}ï¼ä¿¡æ¯ï¼{httpResponseResult.ErrorMessage}"; |
| | | } |
| | | else if (httpResponseResult?.Data?.Code != "200") |
| | | { |
| | | message = $"è°ç¨MESæ¥å£å¤±è´¥ï¼ä»£ç ï¼{httpResponseResult?.Data?.Code}ï¼ä¿¡æ¯ï¼{httpResponseResult?.Data?.Message}"; |
| | | } |
| | | } |
| | | |
| | | Dt_MesReturnRecord mesReturnRecord = new Dt_MesReturnRecord() |
| | | { |
| | | ApiUrl = httpResponseResult.ApiUrl, |
| | | InterfaceType = outboundOrder.OrderType == 0 ? 1 : 3, |
| | | OrderId = outboundOrder.Id, |
| | | OrderNo = outboundOrder.OrderNo, |
| | | RequestCode = reqCode, |
| | | RequestData = requestData, |
| | | FailureReason = message, |
| | | LastReturnTime = DateTime.Now, |
| | | HttpStatusCode = httpResponseResult.StatusCode.ObjToInt(), |
| | | ResponseData = httpResponseResult.Content, |
| | | ReturnType = 0, |
| | | ReturnCount = 1, |
| | | ReturnStatus = isSuccess ? 1 : 2, |
| | | SuccessTime = isSuccess ? DateTime.Now : null |
| | | }; |
| | | |
| | | _unitOfWorkManage.BeginTran(); |
| | | _unitOfWorkManage.Db.Insertable(mesReturnRecord).ExecuteCommand(); |
| | | |
| | | List<Dt_OutboundOrderDetail> outboundOrderDetails = outboundOrder.Details.Where(x => lineNos.Contains(x.lineNo)).ToList(); |
| | | outboundOrderDetails.ForEach(x => |
| | | { |
| | | if (x.OverOutQuantity == x.OrderQuantity - x.MoveQty) |
| | | { |
| | | x.ReturnToMESStatus = isSuccess ? 1 : 2; |
| | | } |
| | | else |
| | | { |
| | | x.ReturnToMESStatus = isSuccess ? 3 : 4; |
| | | } |
| | | x.CurrentDeliveryQty = 0; |
| | | x.ReturnJsonData = ""; |
| | | }); |
| | | |
| | | mesReturnRecord.ReturnType = outboundOrder.Details.Count == outboundOrderDetails.Count ? 1 : 2; |
| | | |
| | | if (outboundOrder.Details.Count == outboundOrderDetails.Count && outboundOrderDetails.All(x => x.ReturnToMESStatus == 1 || x.ReturnToMESStatus == 2)) |
| | | { |
| | | outboundOrder.ReturnToMESStatus = isSuccess ? 1 : 2; |
| | | } |
| | | else |
| | | { |
| | | outboundOrder.ReturnToMESStatus = isSuccess ? 3 : 4; |
| | | } |
| | | |
| | | _outboundOrderService.Db.Updateable(outboundOrderDetails).ExecuteCommand(); |
| | | _outboundOrderService.UpdateData(outboundOrder); |
| | | |
| | | _unitOfWorkManage.CommitTran(); |
| | | |
| | | try |
| | | { |
| | | _locationStatusChangeRecordService.AddLocationStatusChangeRecord(locationInfo, beforelocationStatus, StockChangeType.Inbound.ObjToInt(), "", task.TaskNum); |