Merge branch 'htq20251215' of http://115.159.85.185:8098/r/ZhongRui/ALDbanyunxiangmu into htq20251215
| | |
| | | import http from '@/api/http.js' |
| | | import { h,createVNode, render,reactive,ref } from 'vue'; |
| | | import { ElDialog , ElForm, ElFormItem, ElInput, ElButton, ElMessage ,ElSelect ,ElOption } from 'element-plus'; // å¼å
¥ElMessageï¼è§£å³æç¤ºæ ååº |
| | | |
| | | import gridBody from '../inbound/extend/Pallet.vue' |
| | | import gridHeader from './extend/EmptyTrayInbound.vue' |
| | | let extension = { |
| | | components: { |
| | | //æ¥è¯¢ç颿©å±ç»ä»¶ |
| | | gridHeader: '', |
| | | gridBody: '', |
| | | gridHeader: gridHeader, |
| | | gridBody: gridBody, |
| | | gridFooter: '', |
| | | //æ°å»ºãç¼è¾å¼¹åºæ¡æ©å±ç»ä»¶ |
| | | modelHeader: '', |
| | |
| | | }, |
| | | tableAction: '', //æå®æå¼ 表çæé(è¿éå¡«å表å,é»è®¤ä¸ç¨å¡«å) |
| | | buttons: { view: [ |
| | | { |
| | | name: 'ç»ç', |
| | | type: 'primary', |
| | | value: 'ç»ç', |
| | | onClick: function () { // ä¿®å¤1ï¼ç§»é¤æ ç¨rowåæ°ï¼å æ¥å¿è°è¯ |
| | | console.log('ç»çæé®è¢«ç¹å»ï¼å¼å§æ ¡éª'); |
| | | const selectedRows = this.$refs.table.getSelected(); |
| | | // { |
| | | // name: 'ç»ç', |
| | | // type: 'primary', |
| | | // value: 'ç»ç', |
| | | // onClick: function () { // ä¿®å¤1ï¼ç§»é¤æ ç¨rowåæ°ï¼å æ¥å¿è°è¯ |
| | | // console.log('ç»çæé®è¢«ç¹å»ï¼å¼å§æ ¡éª'); |
| | | // const selectedRows = this.$refs.table.getSelected(); |
| | | |
| | | // æ ¡éª1ï¼æ¯å¦éä¸è¡ |
| | | if (selectedRows.length === 0) { |
| | | console.log('æ ¡éªä¸éè¿ï¼æªéä¸ä»»ä½åæ®'); |
| | | ElMessage.warning('è¯·éæ©ä¸æ¡åæ®'); |
| | | return; |
| | | } |
| | | // æ ¡éª2ï¼æ¯å¦éä¸åè¡ |
| | | if (selectedRows.length > 1) { |
| | | console.log('æ ¡éªä¸éè¿ï¼éä¸å¤è¡åæ®'); |
| | | ElMessage.warning('åªè½éæ©ä¸æ¡åæ®'); |
| | | return; |
| | | } |
| | | // // æ ¡éª1ï¼æ¯å¦éä¸è¡ |
| | | // if (selectedRows.length === 0) { |
| | | // console.log('æ ¡éªä¸éè¿ï¼æªéä¸ä»»ä½åæ®'); |
| | | // ElMessage.warning('è¯·éæ©ä¸æ¡åæ®'); |
| | | // return; |
| | | // } |
| | | // // æ ¡éª2ï¼æ¯å¦éä¸åè¡ |
| | | // if (selectedRows.length > 1) { |
| | | // console.log('æ ¡éªä¸éè¿ï¼éä¸å¤è¡åæ®'); |
| | | // ElMessage.warning('åªè½éæ©ä¸æ¡åæ®'); |
| | | // return; |
| | | // } |
| | | |
| | | const targetRow = selectedRows[0]; |
| | | // const targetRow = selectedRows[0]; |
| | | |
| | | this.$emit('openPalletDialog', targetRow.orderNo); |
| | | } |
| | | }, |
| | | // this.$emit('openPalletDialog', targetRow.orderNo); |
| | | // } |
| | | // }, |
| | | { |
| | | name: 'æ¤éç»ç', |
| | | type: 'primary', |
| | |
| | | ElMessage.error('ç½ç»å¼å¸¸ææ¥å£é误ï¼è¯·ç¨åéè¯'); |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | name: '空æçå
¥åº', |
| | | type: 'primary', |
| | | value: '空æçå
¥åº', |
| | | |
| | | onClick: function () { |
| | | const mountNode = document.createElement('div'); |
| | | document.body.appendChild(mountNode); |
| | | |
| | | const boxCodeReg = /^[A-Z]\d{9}$/; |
| | | // ååºå¼è¡¨åæ°æ®ï¼æç®±ç ï¼å¿
å¡«ï¼æ«ç æª/æå¨è¾å
¥ï¼ |
| | | const formData = reactive({ |
| | | boxCode: '', |
| | | warehouseCode:'' |
| | | }); |
| | | |
| | | const warehouses = ref([]); |
| | | const isLoadingWarehouses = ref(false); |
| | | |
| | | const getWarehouseList = async () => { |
| | | isLoadingWarehouses.value = true; |
| | | try { |
| | | const { data, status } = await http.post('/api/LocationInfo/GetLocationTypes'); |
| | | if (status && Array.isArray(data)) { |
| | | // æ ¼å¼åä»åºé项ï¼éé
ElSelectçlabel-valueæ ¼å¼ |
| | | warehouses.value = data.map(item => ({ |
| | | label: item.locationTypeDesc, |
| | | value: item.locationType |
| | | })); |
| | | } else { |
| | | ElMessage.error('è·ååºåå表失败'); |
| | | warehouses.value = []; |
| | | } |
| | | } catch (err) { |
| | | ElMessage.error('åºåæ°æ®è¯·æ±å¼å¸¸ï¼è¯·ç¨åéè¯'); |
| | | warehouses.value = []; |
| | | } finally { |
| | | isLoadingWarehouses.value = false; |
| | | } |
| | | }; |
| | | |
| | | // æäº¤è¡¨åçç»ä¸é»è¾ï¼ä¾å车触ååæé®ç¹å»å
±ç¨ï¼ |
| | | const submitForm = async () => { |
| | | const formRef = vnode.component.refs.batchInForm; |
| | | |
| | | if (!boxCodeReg.test(formData.boxCode.trim())) { |
| | | ElMessage.warning('æç®±ç æ ¼å¼é误'); |
| | | selectBoxCodeInput(); |
| | | return; |
| | | } |
| | | |
| | | try { |
| | | // æ§è¡è¡¨åæ ¡éªï¼æç®±ç å¿
å¡«ï¼ |
| | | await formRef.validate(); |
| | | } catch (err) { |
| | | const errorMsg = err?.[0]?.message || '请è¾å
¥ææçæç®±ç '; |
| | | ElMessage.warning(errorMsg); |
| | | selectBoxCodeInput(); |
| | | return; |
| | | } |
| | | |
| | | http.post('/api/InboundOrder/EmptyMaterielGroup', { |
| | | palletCode: formData.boxCode.trim(), |
| | | warehouseCode:formData.warehouseCode |
| | | }).then(({ data, status, message }) => { |
| | | if (status) { |
| | | ElMessage.success(`å
¥åºæåï¼æç®±ç ï¼${formData.boxCode.trim()}`); |
| | | this.refresh(); |
| | | formData.boxCode = ''; |
| | | |
| | | setTimeout(() => { |
| | | const inputRef = vnode.component.refs.boxCodeInput; |
| | | inputRef?.focus(); |
| | | }, 100); |
| | | } else { |
| | | ElMessage.error(message || data?.message || 'å
¥åºå¤±è´¥'); |
| | | selectBoxCodeInput(); |
| | | } |
| | | }).catch(() => { |
| | | ElMessage.error('请æ±å¤±è´¥ï¼è¯·ç¨åéè¯'); |
| | | selectBoxCodeInput(); |
| | | }); |
| | | }; |
| | | |
| | | const selectBoxCodeInput = () => { |
| | | setTimeout(() => { |
| | | const inputRef = vnode.component.refs.boxCodeInput; |
| | | if (inputRef) { |
| | | const targetInput = inputRef.$el?.querySelector('input') || inputRef; |
| | | targetInput?.focus(); |
| | | targetInput?.select(); |
| | | } |
| | | }, 100); |
| | | } |
| | | const vnode = createVNode(ElDialog, { |
| | | title: '空æçå
¥åº', |
| | | width: '400px', |
| | | modelValue: true, |
| | | appendToBody: true, |
| | | |
| | | onOpened: async () => { |
| | | await getWarehouseList(); |
| | | const inputRef = vnode.component.refs.boxCodeInput; |
| | | inputRef?.focus(); |
| | | }, |
| | | 'onUpdate:modelValue': (isVisible) => { |
| | | if (!isVisible) { |
| | | render(null, mountNode); |
| | | document.body.removeChild(mountNode); |
| | | } |
| | | } |
| | | }, { |
| | | default: () => h(ElForm, { |
| | | model: formData, |
| | | rules: { |
| | | boxCode: [ |
| | | { required: true, message: '请è¾å
¥æç®±ç ', trigger: ['blur', 'change'] }, |
| | | { pattern: boxCodeReg, message: 'æç®±ç æ ¼å¼é误', trigger: ['blur', 'change'] } |
| | | ], |
| | | warehouseCode:[ |
| | | { required: true, message: 'è¯·éæ©åºå', trigger: ['change', 'blur'] } |
| | | ] |
| | | }, |
| | | ref: 'batchInForm' |
| | | }, [ |
| | | //ä»åºæ°æ® |
| | | h(ElFormItem, { label: 'åºå', prop: 'warehouseCode', required: true }, [ |
| | | h(ElSelect, { |
| | | modelValue: formData.warehouseCode, |
| | | 'onUpdate:modelValue': (val) => { |
| | | formData.warehouseCode = val; |
| | | }, |
| | | placeholder: 'è¯·éæ©å
¥åºåºå', |
| | | filterable: true, // æ¯ææç´¢ä»åº |
| | | loading: isLoadingWarehouses.value, // å è½½ç¶æ |
| | | style: { width: '100%' } |
| | | }, [ |
| | | // 渲æä»åºä¸æé项 |
| | | warehouses.value.map(item => h(ElOption, { |
| | | label: item.label, |
| | | value: item.value |
| | | })) |
| | | ]) |
| | | ]), |
| | | // æç®±ç è¾å
¥é¡¹ï¼æ¯æèç¦ãå车æäº¤ï¼ |
| | | h(ElFormItem, { label: 'æç®±ç ', prop: 'boxCode', required: true }, [ |
| | | h(ElInput, { |
| | | type: 'text', |
| | | modelValue: formData.boxCode, |
| | | 'onUpdate:modelValue': (val) => { |
| | | formData.boxCode = val; |
| | | }, |
| | | ref: 'boxCodeInput', |
| | | placeholder: 'æ«ç è¾å
¥ææå¨è¾å
¥æç®±ç ', |
| | | // çå¬å车äºä»¶ï¼æ«ç æªé»è®¤ä¼åéåè½¦ï¼ |
| | | onKeydown: (e) => { |
| | | if (e.key === 'Enter') { |
| | | e.preventDefault(); |
| | | submitForm(); |
| | | } |
| | | } |
| | | }) |
| | | ]), |
| | | // åºé¨æé®åº |
| | | h('div', { style: { textAlign: 'right', marginTop: '16px' } }, [ |
| | | h(ElButton, { |
| | | type: 'text', |
| | | onClick: () => { |
| | | render(null, mountNode); |
| | | document.body.removeChild(mountNode); |
| | | ElMessage.info('åæ¶å
¥åºä»»å¡'); |
| | | } |
| | | }, 'åæ¶'), |
| | | h(ElButton, { |
| | | type: 'primary', |
| | | onClick: submitForm |
| | | }, 'ç¡®å®') |
| | | ]) |
| | | ]) |
| | | }); |
| | | |
| | | vnode.appContext = this.$.appContext; |
| | | render(vnode, mountNode); |
| | | } |
| | | } |
| | | ], box: [], detail: [] }, |
| | | },], box: [], detail: [] }, |
| | | methods: { |
| | | //ä¸é¢è¿äºæ¹æ³å¯ä»¥ä¿çä¹å¯ä»¥å é¤ |
| | | onInit() { |
| | | var GroupPalletBtn = this.buttons.find(x => x.value == "GroupPallet"); |
| | | if (GroupPalletBtn != null) { |
| | | GroupPalletBtn.onClick = () => { |
| | | this.$refs.gridBody.open(); |
| | | } |
| | | } |
| | | var EmptyTrayInboundBtn = this.buttons.find(x => x.value == "EmptyTrayInbound"); |
| | | if (EmptyTrayInboundBtn != null) { |
| | | EmptyTrayInboundBtn.onClick = () => { |
| | | this.$refs.gridHeader.open(); |
| | | } |
| | | } |
| | | }, |
| | | onInited() { |
| | | |
| | |
| | | this.sumLoading = true; |
| | | this.sumError = ''; |
| | | try { |
| | | const response = await http.post('/api/InboundOrder/UnPalletQuantity?orderNo=' + this.docNo, {}); |
| | | const response = await http.post('/api/InboundOrder/UnPalletQuantity?orderNo=' + this.orderNo, {}); |
| | | if (response.data) { |
| | | this.totalStockSum = response.data.stockSumQuantity || 0; |
| | | this.totalStockCount = response.data.stockCount || 0; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.ComponentModel; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace WIDESEA_Common.OrderEnum |
| | | { |
| | | /// <summary> |
| | | /// çç¹ç¶æ |
| | | /// </summary> |
| | | public enum TakeStockStatusEnum |
| | | { |
| | | /// <summary> |
| | | /// æªçç¹ |
| | | /// </summary> |
| | | [Description("æªçç¹")] |
| | | æªçç¹ = 0, |
| | | |
| | | /// <summary> |
| | | /// çç¹ä¸ |
| | | /// </summary> |
| | | [Description("çç¹ä¸")] |
| | | çç¹ä¸ = 1, |
| | | |
| | | /// <summary> |
| | | /// çç¹å®æ |
| | | /// </summary> |
| | | [Description("çç¹å®æ")] |
| | | çç¹å®æ = 2, |
| | | |
| | | /// <summary> |
| | | /// çç¹å
³é |
| | | /// </summary> |
| | | [Description("çç¹å
³é")] |
| | | çç¹å
³é = 3, |
| | | } |
| | | /// <summary> |
| | | /// çç¹æç»ç¶æ |
| | | /// </summary> |
| | | public enum TakeStockDetailStatusEnum |
| | | { |
| | | /// <summary> |
| | | /// æªçç¹ |
| | | /// </summary> |
| | | [Description("æªçç¹")] |
| | | æªçç¹ = 0, |
| | | |
| | | /// <summary> |
| | | /// çç¹ä¸ |
| | | /// </summary> |
| | | [Description("çç¹åºåºä¸")] |
| | | çç¹åºåºä¸ = 1, |
| | | |
| | | /// <summary> |
| | | /// çç¹åºåºå®æ |
| | | /// </summary> |
| | | [Description("çç¹åºåºå®æ")] |
| | | çç¹åºåºå®æ = 2, |
| | | |
| | | /// <summary> |
| | | /// çç¹å®æ |
| | | /// </summary> |
| | | [Description("çç¹å®æ")] |
| | | çç¹å®æ = 3 |
| | | } |
| | | } |
| | |
| | | [Description("è°æ¨åå·ç¼ç è§å")] |
| | | AllocateOrderCodeRule, |
| | | |
| | | NewBarcodeRule |
| | | NewBarcodeRule, |
| | | /// <summary> |
| | | /// çç¹åå·ç¼ç è§å |
| | | /// </summary> |
| | | [Description("çç¹åå·ç¼ç è§å")] |
| | | PDCodeRule |
| | | |
| | | |
| | | } |
| | | } |
| | |
| | | Task<WebResponseContent> GenerateOutboundBatchTasksAsync(int orderDetailId, decimal batchQuantity, string outStation); |
| | | |
| | | Task<WebResponseContent> GenerateAllocatOutboundTask(int orderDetailId, List<StockSelectViewDTO> stockSelectViews, string station); |
| | | |
| | | /// <summary> |
| | | /// åºåçç¹ |
| | | /// </summary> |
| | | /// <param name="stockViews"></param> |
| | | /// <returns></returns> |
| | | Task <WebResponseContent> TakeOutbound(List<StockViewDTO> stockViews,string outStation); |
| | | } |
| | | } |
| | |
| | | return content.Error($"ä»åºä¸æ²¡æè¯¥{palletDto.WarehouseType}ç¼å·ã"); |
| | | } |
| | | |
| | | List<Dt_InboundOrderDetail> details = new List<Dt_InboundOrderDetail>(); |
| | | Dt_InboundOrder inboundOrder = new Dt_InboundOrder(); |
| | | details = _inboundOrderDetailRepository.QueryData(x => x.OutBoxbarcodes == palletDto.Barcode && x.OrderDetailStatus == (int)InOrderStatusEnum.æªå¼å§); |
| | | if (details.Count <= 0) |
| | | { |
| | | details = _inboundOrderDetailRepository.QueryData(x => x.Barcode == palletDto.Barcode && x.OrderDetailStatus == (int)InOrderStatusEnum.æªå¼å§); |
| | | } |
| | | var details = _inboundOrderDetailRepository.QueryData(x => (x.OutBoxbarcodes == palletDto.Barcode|| x.Barcode == palletDto.Barcode) && x.OrderDetailStatus == (int)InOrderStatusEnum.æªå¼å§); |
| | | |
| | | if (details.Count() <= 0) |
| | | { |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using SqlSugar; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core.Attributes; |
| | | using WIDESEA_Core.CodeConfigEnum; |
| | | using WIDESEA_Core.DB.Models; |
| | | using WIDESEA_Core.Enums; |
| | | |
| | | namespace WIDESEA_Model.Models |
| | | { |
| | | /// <summary> |
| | | /// çç¹å |
| | | /// </summary> |
| | | [SugarTable(nameof(Dt_TakeStockOrder), "çç¹å")] |
| | | public class Dt_TakeStockOrder : BaseEntity |
| | | { |
| | | /// <summary> |
| | | /// ä¸»é® |
| | | /// </summary> |
| | | [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "主é®")] |
| | | public int Id { get; set; } |
| | | |
| | | /// <summary> |
| | | /// çç¹åå· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "çç¹åå·")] |
| | | public string OrderNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä»åºä¸»é® |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "æå±ä»åº")] |
| | | public int WarehouseId { get; set; } |
| | | |
| | | /// <summary> |
| | | /// çç¹ç¶æ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "çç¹ç¶æ")] |
| | | public int TakeStockStatus { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 夿³¨ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 500, ColumnDescription = "夿³¨")] |
| | | public string Remark { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 夿³¨ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 500, ColumnDescription = "æå«çç¹æç")] |
| | | public string AllPalletCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// çç¹æç» |
| | | /// </summary> |
| | | [PropertyValidate("çç¹æç»", NotNullAndEmpty = true), Navigate(NavigateType.OneToMany, nameof(Dt_TakeStockOrderDetail.TakeStockId), nameof(Id))] |
| | | public List<Dt_TakeStockOrderDetail> Details { get; set; } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using SqlSugar; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core.DB.Models; |
| | | |
| | | namespace WIDESEA_Model.Models |
| | | { |
| | | /// <summary> |
| | | /// çç¹åæç» |
| | | /// </summary> |
| | | [SugarTable(nameof(Dt_TakeStockOrderDetail), "çç¹åæç»")] |
| | | public class Dt_TakeStockOrderDetail : BaseEntity |
| | | { |
| | | /// <summary> |
| | | /// ä¸»é® |
| | | /// </summary> |
| | | [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "主é®")] |
| | | public int Id { get; set; } |
| | | |
| | | /// <summary> |
| | | /// çç¹åä¸»é® |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "çç¹å主é®")] |
| | | public int TakeStockId { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç©æç¼ç |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "ç©æç¼ç ")] |
| | | public string MaterielCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç©æåç§° |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 200, ColumnDescription = "ç©æåç§°")] |
| | | public string MaterielName { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ¹æ¬¡å· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "æ¹æ¬¡å·")] |
| | | public string BatchNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç©æè§æ ¼ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 200, ColumnDescription = "ç©æè§æ ¼")] |
| | | public string MaterielSpec { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åä»ä½ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "åä»ä½")] |
| | | public string LocationCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// çç¹æç |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "çç¹æç")] |
| | | public string TakePalletCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// çç¹æç»ç¶æ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, ColumnDescription = "çç¹æç»ç¶æ")] |
| | | public int TakeDetalStatus { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åä½ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "åä½")] |
| | | public string Unit { get; set; } |
| | | |
| | | /// <summary> |
| | | /// è´¦é¢æ°é |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, ColumnDescription = "è´¦é¢æ°é")] |
| | | public decimal SysQty { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å®çæ°é |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, ColumnDescription = "å®çæ°é")] |
| | | public decimal Qty { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 夿³¨ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 500, ColumnDescription = "夿³¨")] |
| | | public string Remark { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ¡ç |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "æ¡ç ")] |
| | | public string barcode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç©æä»åº |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 20, ColumnDescription = "ç©æä»åº")] |
| | | public string WarehouseCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ååº |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 10, ColumnDescription = "ååº")] |
| | | public string FactoryArea { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä¾åºåç¼å· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 20, ColumnDescription = "ä¾åºåç¼å·")] |
| | | public string SupplyCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// çç¹ååæ® |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "çç¹ååæ®")] |
| | | public string TakeStockNo { get; set; } |
| | | } |
| | | } |
| | |
| | | using Microsoft.Extensions.Logging; |
| | | using Newtonsoft.Json; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup; |
| | | using SqlSugar; |
| | | using System; |
| | | using System.Collections.Concurrent; |
| | | using System.Collections.Generic; |
| | |
| | | using WIDESEA_Common.StockEnum; |
| | | using WIDESEA_Common.TaskEnum; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.CodeConfigEnum; |
| | | using WIDESEA_Core.DB; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_Core.Seed; |
| | | using WIDESEA_DTO.Basic; |
| | | using WIDESEA_DTO.Stock; |
| | | using WIDESEA_IBasicService; |
| | | using WIDESEA_Model.Models; |
| | | using WIDESEA_Model.Models.Basic; |
| | | using WIDESEA_Model.Models.Check; |
| | |
| | | |
| | | #endregion |
| | | |
| | | /// <summary> |
| | | /// éå®åºåçæçç¹ååºåº |
| | | /// </summary> |
| | | /// <param name="id"></param> |
| | | /// <returns></returns> |
| | | public async Task<WebResponseContent> TakeOutbound(List<StockViewDTO> stockViews, string outStation) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | List<int> ids = stockViews.Select(x => x.StockId).ToList(); |
| | | //è·ååºå |
| | | List<Dt_StockInfo> stockInfos = _stockRepository.Db.Queryable<Dt_StockInfo>().Where(x => ids.Contains(x.Id)).Includes(x => x.Details).ToList(); |
| | | if (stockInfos.Count != stockViews.Count) |
| | | { |
| | | StockViewDTO? stockViewDTO = stockViews.FirstOrDefault(x => !stockInfos.Select(x => x.PalletCode).ToList().Contains(x.PalletCode)); |
| | | return content.Error($"æªæ¾å°{stockViewDTO?.PalletCode}åºå"); |
| | | } |
| | | //è·åè´§ä½ |
| | | List<string> locStrs = stockInfos.Select(x => x.LocationCode).ToList(); |
| | | List<Dt_LocationInfo> locationInfos = (List<Dt_LocationInfo>)_locationInfoService.Db.Queryable<Dt_LocationInfo>().Where(x => locStrs.Contains(x.LocationCode)); |
| | | if (stockInfos.Count != locationInfos.Count) |
| | | { |
| | | string? locStr = locStrs.FirstOrDefault(x => !locationInfos.Select(x => x.LocationCode).ToList().Contains(x)); |
| | | return content.Error($"æªæ¾å°{locStr}è´§ä½æ°æ®"); |
| | | } |
| | | Dt_TakeStockOrder takeStockOrder = new Dt_TakeStockOrder() |
| | | { |
| | | WarehouseId = stockInfos.FirstOrDefault().WarehouseId, |
| | | TakeStockStatus = TakeStockStatusEnum.çç¹ä¸.ObjToInt(), |
| | | OrderNo = CreateCodeByRule(nameof(RuleCodeEnum.PDCodeRule)), |
| | | Details = new List<Dt_TakeStockOrderDetail>() |
| | | }; |
| | | foreach (var item in stockInfos) |
| | | { |
| | | if (item.Details.Count <= 0) |
| | | { |
| | | return content.Error($"æªæ¾å°{item.PalletCode}åºåæç»æ°æ®"); |
| | | } |
| | | Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.LocationCode == item.LocationCode); |
| | | if (locationInfo == null && (locationInfo.EnableStatus == EnableStatusEnum.Disable.ObjToInt() || locationInfo.EnableStatus != EnableStatusEnum.Normal.ObjToInt()) && locationInfo.LocationStatus != LocationStatusEnum.InStock.ObjToInt() && item.StockStatus != StockStatusEmun.å
¥åºå®æ.ObjToInt()) |
| | | { |
| | | content.Error($"{item.PalletCode}è´§ä½æåºåç¶æä¸æ»¡è¶³åºåºæ¡ä»¶"); |
| | | } |
| | | } |
| | | List<Dt_Task> tasks = GetTasks(stockInfos, TaskTypeEnum.OutInventory,outStation); |
| | | if (tasks == null || tasks.Count <= 0) |
| | | { |
| | | return content.Error($"çæä»»å¡å¤±è´¥"); |
| | | } |
| | | stockInfos.ForEach(x => |
| | | { |
| | | x.StockStatus = StockStatusEmun.åºåºéå®.ObjToInt(); |
| | | }); |
| | | tasks.ForEach(x => |
| | | { |
| | | x.OrderNo = takeStockOrder.OrderNo; |
| | | }); |
| | | locationInfos.ForEach(x => |
| | | { |
| | | x.LocationStatus = LocationStatusEnum.Lock.ObjToInt(); |
| | | }); |
| | | _unitOfWorkManage.BeginTran(); |
| | | //æ´æ°åºåç¶æ |
| | | _stockRepository.UpdateData(stockInfos); |
| | | BaseDal.Db.InsertNav(takeStockOrder); |
| | | //æ°å»ºä»»å¡ |
| | | BaseDal.AddData(tasks); |
| | | _locationInfoService.UpdateData(locationInfos); |
| | | _unitOfWorkManage.CommitTran(); |
| | | TaskModel esstask = new TaskModel() |
| | | { |
| | | taskType = "carry", |
| | | taskGroupCode = "", |
| | | groupPriority = 0, |
| | | tasks = new List<TasksType>() |
| | | }; |
| | | |
| | | foreach (var task in tasks) |
| | | { |
| | | esstask. |
| | | tasks.Add(new TasksType |
| | | { |
| | | taskCode = task.TaskNum.ToString(), |
| | | taskPriority = 0, |
| | | taskDescribe = new TaskDescribeType |
| | | { |
| | | containerCode = task.PalletCode, |
| | | containerType = "CT_KUBOT_STANDARD", |
| | | fromLocationCode = task.SourceAddress ?? "", |
| | | toStationCode = "", |
| | | toLocationCode = task.TargetAddress, |
| | | deadline = 0, |
| | | storageTag = "" |
| | | } |
| | | } |
| | | ); |
| | | } |
| | | var result = await _eSSApiService.CreateTaskAsync(esstask); |
| | | |
| | | _logger.LogInformation("å建任å¡PalletOutboundTask è¿å: " + result); |
| | | if (result) |
| | | { |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | else |
| | | { |
| | | return WebResponseContent.Instance.Error("ä¸åæºå¨äººä»»å¡å¤±è´¥ï¼"); |
| | | } |
| | | content.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | /// <summary> |
| | | /// åæ®çææ¹æ³ |
| | | /// </summary> |
| | | static object lock_code = new object(); |
| | | public string CreateCodeByRule(string ruleCode) |
| | | { |
| | | lock (lock_code) |
| | | { |
| | | |
| | | string code = string.Empty; |
| | | DateTime dateTime = DateTime.Now; |
| | | DateTime now = DateTime.Now; |
| | | try |
| | | { |
| | | if (string.IsNullOrEmpty(ruleCode)) |
| | | throw new ArgumentNullException(nameof(ruleCode)); |
| | | SqlSugarClient sugarClient = new SqlSugarClient(new ConnectionConfig |
| | | { |
| | | IsAutoCloseConnection = true, |
| | | DbType = DbType.SqlServer, |
| | | ConnectionString = DBContext.ConnectionString |
| | | }); |
| | | Dt_CodeRuleConfig codeRuleConfig = sugarClient.Queryable<Dt_CodeRuleConfig>().Where(x => x.RuleCode == ruleCode).First(); |
| | | if (codeRuleConfig == null) |
| | | throw new ArgumentNullException(nameof(codeRuleConfig)); |
| | | if (codeRuleConfig.ModifyDate != null) |
| | | { |
| | | dateTime = Convert.ToDateTime(codeRuleConfig.ModifyDate); |
| | | } |
| | | else |
| | | { |
| | | dateTime = Convert.ToDateTime(codeRuleConfig.CreateDate); |
| | | } |
| | | |
| | | if (now.Year == dateTime.Year && now.Month == dateTime.Month && now.Day == dateTime.Day) |
| | | { |
| | | now = dateTime; |
| | | codeRuleConfig.CurrentVal = Convert.ToInt32(codeRuleConfig.CurrentVal) + 1; |
| | | } |
| | | else |
| | | { |
| | | codeRuleConfig.CurrentVal = 1; |
| | | } |
| | | codeRuleConfig.ModifyDate = DateTime.Now; |
| | | code = codeRuleConfig.StartStr + codeRuleConfig.Format; |
| | | code = code.Replace($"[{CodeFormatTypeEnum.YYYY}]", now.Year.ToString().PadLeft(4, '0')); |
| | | code = code.Replace($"[{CodeFormatTypeEnum.MM}]", now.Month.ToString().PadLeft(2, '0')); |
| | | code = code.Replace($"[{CodeFormatTypeEnum.DD}]", now.Day.ToString().PadLeft(2, '0')); |
| | | code = code.Replace($"[{CodeFormatTypeEnum.ST}]", codeRuleConfig.StartStr?.ToString() ?? ""); |
| | | code = code.Replace($"[{CodeFormatTypeEnum.NUM}]", codeRuleConfig.CurrentVal.ToString().PadLeft(codeRuleConfig.Length, '0')); |
| | | Dictionary<string, object> keyValuePairs = new Dictionary<string, object>() { { nameof(codeRuleConfig.CurrentVal), codeRuleConfig.CurrentVal }, { nameof(codeRuleConfig.Id), codeRuleConfig.Id }, { nameof(codeRuleConfig.ModifyDate), DateTime.Now } }; |
| | | sugarClient.Updateable(keyValuePairs).AS(MainDb.CodeRuleConfig).WhereColumns(nameof(codeRuleConfig.Id)).ExecuteCommand(); |
| | | sugarClient.Updateable(codeRuleConfig); |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | } |
| | | return code; |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | return await Service.GenerateOutboundBatchTasksAsync(data.orderDetailId,data.batchQuantity, data.outboundPlatform); |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// çç¹åºååºåº |
| | | /// </summary> |
| | | /// <param name="stockViews"></param> |
| | | /// <param name="outStation"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, HttpGet, Route("TakeOutbound"), AllowAnonymous] |
| | | public async Task<WebResponseContent> TakeOutbound([FromBody] List<StockViewDTO> stockViews, string outStation) |
| | | { |
| | | return await Service.TakeOutbound(stockViews, outStation); |
| | | } |
| | | |
| | | |
| | | } |
| | | } |