pan
2025-11-22 0b84af0415c00bdc82d537f0408cb974e7d31586
提交
已添加4个文件
已修改9个文件
2004 ■■■■■ 文件已修改
项目代码/WIDESEA_WMSClient/src/extension/inbound/allocateinboundOrder.js 456 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WIDESEA_WMSClient/src/extension/outbound/allocateoutboundOrder.js 374 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WIDESEA_WMSClient/src/router/viewGird.js 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WIDESEA_WMSClient/src/views/inbound/allocateinboundOrder.vue 397 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WIDESEA_WMSClient/src/views/outbound/allocateoutboundOrder.vue 443 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_BasicService/InvokeMESService.cs 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_Common/StockEnum/StockStatusEmun.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_DTO/Allocate/AllocateDto.cs 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_IBasicService/IInvokeMESService.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundPickingService.cs 197 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_TaskInfoService/WIDESEA_TaskInfoService.csproj 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Allocate/AllocateOrderController.cs 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ÏîÄ¿´úÂë/WIDESEA_WMSClient/src/extension/inbound/allocateinboundOrder.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,456 @@
//此js文件是用来自定义扩展业务代码,可以扩展一些自定义页面或者重新配置生成的代码
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,解决提示无反应
let extension = {
    components: {
      //查询界面扩展组件
      gridHeader: '',
      gridBody: '',
      gridFooter: '',
      //新建、编辑弹出框扩展组件
      modelHeader: '',
      modelBody: '',
      modelFooter: ''
    },
    tableAction: '', //指定某张表的权限(这里填写表名,默认不用填写)
    buttons: { view: [
       {
        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;
          }
          const targetRow = selectedRows[0];
          this.$emit('openPalletDialog', targetRow.inboundOrderNo);
        }
      },
      {
                name: '撤销组盘',
                type: 'primary',
                value: '撤销组盘',
                onClick: function () {
                    console.log('撤销组盘按钮被点击');
                    const mountNode = document.createElement('div');
                    document.body.appendChild(mountNode);
                    // å“åº”式表单数据:托盘号(必填)
                    const formData = reactive({
                        palletCode: '' // æ‰˜ç›˜å·è¾“入框
                    });
                    // æäº¤è¡¨å•的统一逻辑
                    const submitForm = async () => {
                        const formRef = vnode.component.refs.cancelPalletForm;
                        try {
                            // æ‰§è¡Œè¡¨å•校验(托盘号必填)
                            await formRef.validate();
                        } catch (err) {
                            ElMessage.warning('请输入有效的托盘号');
                            return;
                        }
                        // å‘起撤销组盘请求
                        try {
                            //console.log('发起撤销组盘请求,托盘号:', formData.palletCode.trim());
                            const response = await http.post('/api/InboundOrder/CancelPalletGroup', {
                                palletCode: formData.palletCode.trim()
                            });
                            const { status, message, data } = response;
                            if (status) {
                                ElMessage.success(`撤销组盘成功,托盘号:${formData.palletCode.trim()}`);
                                this.refresh(); // æˆåŠŸåŽåˆ·æ–°åˆ—è¡¨
                                // å…³é—­å¯¹è¯æ¡†
                                render(null, mountNode);
                                document.body.removeChild(mountNode);
                            } else {
                                console.log('撤销组盘失败,后端提示:', message);
                                ElMessage.error(message || data?.message || '撤销组盘失败');
                                selectPalletCodeInput(); // é€‰ä¸­è¾“入框方便重新输入
                            }
                        } catch (error) {
                            console.error('撤销组盘请求异常:', error);
                            ElMessage.error('网络异常或接口错误,请稍后重试');
                            selectPalletCodeInput();
                        }
                    };
                    // é€‰ä¸­è¾“入框文本(方便重新输入)
                    const selectPalletCodeInput = () => {
                        setTimeout(() => {
                            const inputRef = vnode.component.refs.palletCodeInput;
                            if (inputRef) {
                                const targetInput = inputRef.$el?.querySelector('input') || inputRef;
                                targetInput?.focus();
                                targetInput?.select();
                            }
                        }, 100);
                    };
                    // åˆ›å»ºå¯¹è¯æ¡†VNode
                    const vnode = createVNode(ElDialog, {
                        title: '撤销组盘',
                        width: '400px',
                        modelValue: true,
                        appendToBody: true,
                        onOpened: () => {
                            // å¯¹è¯æ¡†æ‰“开后自动聚焦输入框
                            setTimeout(() => {
                                const inputRef = vnode.component.refs.palletCodeInput;
                                inputRef?.focus();
                            }, 100);
                        },
                        'onUpdate:modelValue': (isVisible) => {
                            if (!isVisible) {
                                render(null, mountNode);
                                document.body.removeChild(mountNode);
                            }
                        }
                    }, {
                        default: () => h(ElForm, {
                            model: formData,
                            rules: {
                                palletCode: [
                                    { required: true, message: '请输入托盘号', trigger: ['blur', 'enter'] },
                                    { min: 1, max: 50, message: '托盘号长度不能超过50个字符', trigger: ['blur', 'input'] }
                                ]
                            },
                            ref: 'cancelPalletForm'
                        }, [
                            // æ‰˜ç›˜å·è¾“入项
                            h(ElFormItem, { label: '托盘号', prop: 'palletCode', required: true }, [
                                h(ElInput, {
                                    type: 'text',
                                    modelValue: formData.palletCode,
                                    'onUpdate:modelValue': (val) => {
                                        formData.palletCode = val;
                                    },
                                    ref: 'palletCodeInput',
                                    placeholder: '扫码输入或手动输入托盘号',
                                    maxLength: 50,
                                    // ç›‘听回车事件(扫码枪默认会发送回车)
                                    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.bind(this) // ç»‘定this上下文
                                }, '确认撤销')
                            ])
                        ])
                    });
                    vnode.appContext = this.$.appContext;
                    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',
  value: '空托盘入库',
  onClick: function () {
    const mountNode = document.createElement('div');
    document.body.appendChild(mountNode);
    // å“åº”式表单数据:料箱码(必填,扫码枪/手动输入)
    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;
      try {
        // æ‰§è¡Œè¡¨å•校验(料箱码必填)
        await formRef.validate();
      } catch (err) {
        ElMessage.warning('请输入有效的料箱码');
        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', 'enter'] }
          ],
          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: [] },
    methods: {
       //下面这些方法可以保留也可以删除
      onInit() {
      },
      onInited() {
        //框架初始化配置后
        //如果要配置明细表,在此方法操作
        //this.detailOptions.columns.forEach(column=>{ });
      },
      searchBefore(param) {
        //界面查询前,可以给param.wheres添加查询参数
        //返回false,则不会执行查询
        let wheres = [{
            'name': 'orderType',
            'value': '115',
            'displayType': 'text'}];
          param.wheres.push(...wheres);
    //   this.searchFormFields.orderType=[115]
        return true;
      },
      searchAfter(result) {
        //查询后,result返回的查询数据,可以在显示到表格前处理表格的值
        return true;
      },
      addBefore(formData) {
        //新建保存前formData为对象,包括明细表,可以给给表单设置值,自己输出看formData的值
        return true;
      },
      updateBefore(formData) {
        //编辑保存前formData为对象,包括明细表、删除行的Id
        return true;
      },
      rowClick({ row, column, event }) {
        //查询界面点击行事件
        this.$refs.table.$refs.table.toggleRowSelection(row); //单击行时选中当前行;
      },
      modelOpenAfter(row) {
        //点击编辑、新建按钮弹出框后,可以在此处写逻辑,如,从后台获取数据
        //(1)判断是编辑还是新建操作: this.currentAction=='Add';
        //(2)给弹出框设置默认值
        //(3)this.editFormFields.字段='xxx';
        //如果需要给下拉框设置默认值,请遍历this.editFormOptions找到字段配置对应data属性的key值
        //看不懂就把输出看:console.log(this.editFormOptions)
      }
    }
  };
  export default extension;
ÏîÄ¿´úÂë/WIDESEA_WMSClient/src/extension/outbound/allocateoutboundOrder.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,374 @@
//此js文件是用来自定义扩展业务代码,可以扩展一些自定义页面或者重新配置生成的代码
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';
import gridBody from './extend/outOrderDetail.vue'
let extension = {
    components: {
      //查询界面扩展组件
      gridHeader: '',
      gridBody: gridBody,
      gridFooter: '',
      //新建、编辑弹出框扩展组件
      modelHeader: '',
      modelBody: '',
      modelFooter: ''
    },
    tableAction: '', //指定某张表的权限(这里填写表名,默认不用填写)
    buttons: { view: [
       /* {
        name: '出库',
        type: 'primary',
        value: '出库',
        onClick: function () { // ä¿®å¤ï¼šç”¨ElMessage替代this.$message
          const selectedRows = this.$refs.table.getSelected();
          if (selectedRows.length === 0) {
            ElMessage.warning('请先选择要生成任务的行');
            return;
          }
          if (selectedRows.length > 1) {
            ElMessage.warning('只能选择一行');
            return;
          }
          // æ‰€æœ‰æ ¡éªŒé€šè¿‡ï¼Œè§¦å‘主组件打开出库弹窗
          console.log('所有校验通过,触发openOutboundDialog事件,单据数据:', selectedRows[0]);
          this.$emit('openOutboundDialog', {
            transNo: selectedRows[0].transNo,       // å‡ºåº“单编号
            createDate: selectedRows[0].createDate || new Date().toLocaleDateString()  // å‡ºåº“日期
          });
        }
      }, */
      {
  name: '空托盘出库',
  type: 'primary',
  value: '空托盘出库',
  onClick: function () {
    const platformOptions = Array.from({ length: 1 }, (_, i) => {
      const num = 1;
      return { label: `站台${num}`, value: `1-2` };
    });
    const quantityOptions = Array.from({ length: 6 }, (_, i) => ({
      label: (i + 1).toString(),
      value: i + 1
    }));
    const warehouseOptions = 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格式
          warehouseOptions.value = data.map(item => ({
            label: item.locationTypeDesc,
            value: item.locationType
          }));
        } else {
          ElMessage.error('获取区域列表失败');
          warehouseOptions.value = [];
        }
      } catch (err) {
        ElMessage.error('区域数据请求异常,请稍后重试');
        warehouseOptions.value = [];
      } finally {
        isLoadingWarehouses.value = false;
      }
    };
    const mountNode = document.createElement('div');
    document.body.appendChild(mountNode);
    const formData = reactive({
      warehouseCode:'',
      palletCode: '',
      selectedPlatform: platformOptions[0].value,
      quantity:1
    });
    const vnode = createVNode(ElDialog, {
      title: '空托盘出库',
      width: '500px',
      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);
        }
      },
      style: {
        padding: '20px 0',
        borderRadius: '8px'
      }
    }, {
      default: () => h(ElForm, {
        model: formData,
        rules: {
          warehouseCode:[
            { required: true, message: '请选择区域', trigger: ['change', 'blur'] }
          ],
          palletCode: [
            { type: 'string', message: '料箱号必须为字符串', trigger: 'blur' }
          ],
          selectedPlatform: [
            { required: true, message: '请选择出库站台', trigger: 'change' }
          ],
          quantity:[
            { required: true, message: '请选择空箱数量', trigger: 'change'}
          ]
        },
        ref: 'batchOutForm',
        labelWidth: '100px',
        style: {
          padding: '0 30px',
        }
       },
       [
      //   h(ElFormItem, {
      //     label: '仓库区域',
      //     prop: 'warehouseCode',
      //     style: {
      //       marginBottom: '24px'
      //     }
      //   }, [
      //     h(ElSelect, {
      //       placeholder: '请选择仓库区域',
      //       modelValue: formData.warehouseCode,
      //       'onUpdate:modelValue': (val) => {
      //         formData.warehouseCode = val;
      //       },
      //       style: {
      //         width: '100%',
      //         height: '40px',
      //         borderRadius: '4px',
      //         borderColor: '#dcdfe6'
      //       }
      //     }, warehouseOptions.value.map(platform =>
      //       h(ElOption, { label: platform.label, value: platform.value })
      //     ))
      //   ]),
        h(ElFormItem, {
          label: '出库站台',
          prop: 'selectedPlatform',
          style: {
            marginBottom: '24px'
          }
        }, [
          h(ElSelect, {
            placeholder: '请选择出库站台',
            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(ElFormItem,{
      //     label:'出库数量',
      //     prop:'quantity',
      //     style:{
      //       marginBottom:'24px'
      //     }
      //   },[h(ElSelect,{
      //     placeholder:'请选择空箱数量',
      //     modelValue:formData.quantity,
      //     'onUpdate:modelValue':(val)=>{
      //       formData.quantity=val;
      //     },
      //     style:{
      //       width:'100%',
      //       height:'40px',
      //       borderRadius:'4px',
      //       borderColor:'#dcdfe6'
      //     },
      //     filterable:false
      //   },
      //   quantityOptions.map(option=>
      //     h(ElOption,{
      //       label:option.label,
      //       value:option.value
      //     })
      //   )
      // )]),
        h(ElFormItem, {
          label: '料箱号',
          prop: 'palletCode',
          style: {
            marginBottom: '16px'
          }
        }, [
          h(ElInput, {
            type: 'text',
            placeholder: '可选输入料箱号,不填则自动分配空料箱',
            modelValue: formData.palletCode,
            'onUpdate:modelValue': (val) => {
              formData.palletCode = val;
            },
            style: {
              width: '100%',
              height: '40px',
              borderRadius: '4px',
              borderColor: '#dcdfe6'
            },
            attrs: {
              placeholderStyle: 'color: #909399;'
            }
          })
        ]),
        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 () => {
              const formRef = vnode.component.refs.batchOutForm;
              try {
                await formRef.validate();
              } catch (err) {
                return;
              }
              http.post('/api/Task/PalletOutboundTask?palletCode='+formData.palletCode+'&endStation='+formData.selectedPlatform, {
              }).then(({ data, status, message }) => {
                if (status) {
                  ElMessage.success(`出库成功`);
                  this.refresh();
                  render(null, mountNode);
                  document.body.removeChild(mountNode);
                } else {
                  ElMessage.error(message || data?.message || '出库失败');
                }
              }).catch(() => {
                ElMessage.error('请求失败,请稍后重试');
              });
            },
            style: {
              borderRadius: '4px',
              padding: '8px 20px'
            }
          }, '确定')
        ])
      ])
    });
    vnode.appContext = this.$.appContext;
    render(vnode, mountNode);
  }
}
    ], box: [], detail: [] }, //扩展的按钮
    methods: {
       //下面这些方法可以保留也可以删除
      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) => {
            const table = this.$refs.table.$refs.table;
            if(table){
              table.clearSelection();
              table.toggleRowSelection(row,true);
            }
              const rowId =row.id;
              console.log(rowId);
              this.$refs.gridBody.open(row);
          }
      });
      },
      onInited() {
        //框架初始化配置后
        //如果要配置明细表,在此方法操作
        //this.detailOptions.columns.forEach(column=>{ });
      },
      searchBefore(param) {
        //界面查询前,可以给param.wheres添加查询参数
        //返回false,则不会执行查询
       //   this.searchFormFields.orderType=[215]
        let wheres = [{
            'name': 'orderType',
            'value': '215',
            'displayType': 'text'}];
          param.wheres.push(...wheres);
        return true;
      },
      searchAfter(result) {
        //查询后,result返回的查询数据,可以在显示到表格前处理表格的值
        return true;
      },
      addBefore(formData) {
        //新建保存前formData为对象,包括明细表,可以给给表单设置值,自己输出看formData的值
        return true;
      },
      updateBefore(formData) {
        //编辑保存前formData为对象,包括明细表、删除行的Id
        return true;
      },
      rowClick({ row, column, event }) {
        //查询界面点击行事件
        this.$refs.table.$refs.table.toggleRowSelection(row); //单击行时选中当前行;
      },
      modelOpenAfter(row) {
        //点击编辑、新建按钮弹出框后,可以在此处写逻辑,如,从后台获取数据
        //(1)判断是编辑还是新建操作: this.currentAction=='Add';
        //(2)给弹出框设置默认值
        //(3)this.editFormFields.字段='xxx';
        //如果需要给下拉框设置默认值,请遍历this.editFormOptions找到字段配置对应data属性的key值
        //看不懂就把输出看:console.log(this.editFormOptions)
      }
    }
  };
  export default extension;
ÏîÄ¿´úÂë/WIDESEA_WMSClient/src/router/viewGird.js
@@ -191,7 +191,16 @@
    path: '/materielToMes',
    name: 'Dt_MaterielToMes',
    component: () => import('@/views/inbound/Dt_MaterielToMes.vue')
  },
  }, {
    path:'/allocateinboundOrder',
    name: 'allocateinboundOrder',
    component: () => import('@/views/inbound/allocateinboundOrder.vue')
  },{
    path:'allocateoutboundOrder',
    name: 'allocateoutboundOrder',
    component: () => import('@/views/outbound/allocateoutboundOrder.vue')
  },
  {
    path: '/allocateOrder',
    name: 'Dt_AllocateOrder',
ÏîÄ¿´úÂë/WIDESEA_WMSClient/src/views/inbound/allocateinboundOrder.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,397 @@
<template>
  <view-grid
    ref="grid"
    @openPalletDialog="handleOpenPalletDialog"
    :columns="columns"
    :detail="detail"
    :editFormFields="editFormFields"
    :editFormOptions="editFormOptions"
    :searchFormFields="searchFormFields"
    :searchFormOptions="searchFormOptions"
    :table="table"
    :extend="extend"
  >
  </view-grid>
      <!-- 2. ç»„盘弹窗:确保props和事件绑定正确 -->
    <PalletDialog
      v-model:visible="palletVisible"
      :docNo="currentPalletDocNo"
      @back-success="handlePalletBackSuccess"
    ></PalletDialog>
</template>
    <script>
import extend from "@/extension/inbound/allocateinboundOrder.js";
import ViewGrid from '@/components/basic/ViewGrid/ViewGrid.vue';
import { ref, defineComponent } from "vue";
import PalletDialog from "@/extension/inbound/extend/Pallet.vue";
export default defineComponent({
   components: {
    // å…³é”®ä¿®å¤2:组件注册名与模板标签名适配(kebab-case对应view-grid)
    viewGrid: ViewGrid,  // æ³¨å†Œä¸ºkebab-case,模板用<view-grid>
    PalletDialog      // æ³¨å†Œç»„盘弹窗
  },
  setup() {
    const table = ref({
      key: "id",
      footer: "Foots",
      cnName: "调拨单(智仓调外部仓库)",
      name: "inboundOrder",
      url: "/InboundOrder/",
      sortName: "id",
    });
    const editFormFields = ref({
      orderType: "",
      inboundOrderNo: "",
      upperOrderNo: "",
      remark: "",
    });
    const editFormOptions = ref([
      [
        {
          title: "单据类型",
          required: true,
          field: "orderType",
          type: "select",
          dataKey: "inOrderType",
          data: [],
        },
        {
          field: "inboundOrderNo",
          title: "单据编号",
          type: "string",
        },
        {
          title: "上游单据编号",
          field: "upperOrderNo",
          type: "string",
        },
        {
          title: "备注",
          field: "remark",
          type: "textarea",
        },
      ],
    ]);
    const searchFormFields = ref({
      inboundOrderNo: "",
      upperOrderNo: "",
      orderType: "115",
      orderStatus: "",
      createType: "",
      creater: "",
      createDate: "",
    });
    const searchFormOptions = ref([
      [
        { title: "单据编号", field: "inboundOrderNo", type: "like" },
        { title: "上游单据编号", field: "upperOrderNo", type: "like" },
        {
          title: "单据类型",
          field: "orderType",
          type: "select",
          dataKey: "inOrderType",
          data: [],
        },
        {
          title: "单据状态",
          field: "orderStatus",
          type: "select",
          dataKey: "inboundState",
          data: [],
        },
      ],
      [
        {
          title: "创建方式",
          field: "createType",
          type: "select",
          dataKey: "createType",
          data: [],
        },
        { title: "创建者", field: "creater", type: "like" },
        { title: "创建时间", field: "createDate", type: "datetime" },
      ],
    ]);
    const columns = ref([
      {
        field: "id",
        title: "Id",
        type: "int",
        width: 90,
        hidden: true,
        readonly: true,
        require: true,
        align: "left",
      },
      {
        field: "inboundOrderNo",
        title: "单据编号",
        type: "string",
        width: 120,
        align: "left",
        link: true,
      },
      {
        field: "upperOrderNo",
        title: "上游单据编号",
        type: "string",
        width: 150,
        align: "left",
      },
      {
        field: "orderType",
        title: "单据类型",
        type: "string",
        width: 150,
        align: "left",
        bind: { key: "inOrderType", data: [] },
      },
      {
        field: "businessType",
        title: "业务类型",
        type: "string",
        width: 150,
        align: "left",
        bind: { key: "businessType", data: [] },
      },
      {
        field: "orderStatus",
        title: "单据状态",
        type: "decimal",
        width: 90,
        align: "left",
        bind: { key: "inboundState", data: [] },
      },
      {
        field: "createType",
        title: "创建方式",
        type: "string",
        width: 120,
        align: "left",
        bind: { key: "createType", data: [] },
      },
      {
        field: "factoryArea",
        title: "厂区",
        type: "string",
        width: 120,
        align: "left"
      },
      {
        field: "creater",
        title: "创建人",
        type: "string",
        width: 90,
        align: "left",
      },
      {
        field: "createDate",
        title: "创建时间",
        type: "datetime",
        width: 160,
        align: "left",
      },
      {
        field: "modifier",
        title: "修改人",
        type: "string",
        width: 100,
        align: "left",
      },
      {
        field: "modifyDate",
        title: "修改时间",
        type: "datetime",
        width: 160,
        align: "left",
      },
      {
        field: "remark",
        title: "备注",
        type: "string",
        width: 100,
        align: "left",
      },
    ]);
    const detail = ref({
      cnName: "调拨单明细",
      table: "InboundOrderDetail",
      columns: [
        {
          field: "id",
          title: "Id",
          type: "int",
          width: 90,
          hidden: true,
          readonly: true,
          require: true,
          align: "left",
        },
        {
          field: "orderId",
          title: "调拨单主键",
          type: "string",
          width: 90,
          align: "left",
          hidden: true,
        },
        {
          field: "materielCode",
          title: "物料编号",
          type: "select",
          width: 150,
          align: "left",
          edit: { type: "" },
          required: true,
        },
        {
          field: "materielCode",
          title: "物料名称",
          type: "string",
          width: 100,
          align: "left",
          bind: { key: "MaterielNames", data: [] },
        },
        {
          field: "batchNo",
          title: "批次号",
          type: "decimal",
          width: 90,
          align: "left",
          edit: { type: "" },
          required: true,
        },
        {
          field: "supplyCode",
          title: "供应商编号",
          type: "decimal",
          width: 90,
          align: "left",
          edit: { type: "" },
          required: true,
        },
        {
          field: "warehouseCode",
          title: "仓库号",
          type: "decimal",
          width: 90,
          align: "left",
          required: true
        },
        {
          field: "barcode",
          title: "条码",
          type: "decimal",
          width: 90,
          align: "left",
          edit: { type: "" },
          required: true,
        },
        {
          field: "orderQuantity",
          title: "单据数量",
          type: "decimal",
          width: 90,
          align: "left",
          edit: { type: "number" },
          required: true,
        },
        {
          field: "receiptQuantity",
          title: "组盘数量",
          type: "int",
          width: 120,
          align: "left",
        },
        {
          field: "overInQuantity",
          title: "上架数量",
          type: "string",
          width: 200,
          align: "left",
        },
        {
          field: "orderDetailStatus",
          title: "订单明细状态",
          type: "string",
          width: 180,
          align: "left",
          bind: { key: "orderDetailStatusEnum", data: [] },
        },
        {
          field: "creater",
          title: "创建人",
          type: "string",
          width: 90,
          align: "left",
        },
        {
          field: "createDate",
          title: "创建时间",
          type: "datetime",
          width: 160,
          align: "left",
        },
        {
          field: "modifier",
          title: "修改人",
          type: "string",
          width: 100,
          align: "left",
        },
        {
          field: "modifyDate",
          title: "修改时间",
          type: "datetime",
          width: 160,
          align: "left",
        },
        {
          field: "remark",
          title: "备注",
          type: "string",
          width: 100,
          align: "left",
        },
      ],
      sortName: "id",
      key: "id",
    });
     // 6. ç»„盘弹窗联动(所有变量必须返回)
    const palletVisible = ref(false);
    const currentPalletDocNo = ref("");
    const handleOpenPalletDialog = (docNo) => {
      console.log('主组件收到组盘事件,单据号:', docNo);
      currentPalletDocNo.value = docNo;
      palletVisible.value = true;
    };
    const handlePalletBackSuccess = () => {
      console.log('组盘回传成功,刷新表格');
      grid.value?.refresh();  // æ­¤æ—¶gridRef已挂载,可调用方法
    };
    return {
      table,
      extend,
      editFormFields,
      editFormOptions,
      searchFormFields,
      searchFormOptions,
      columns,
      detail,
       // ç»„盘弹窗相关
      PalletDialog,    // å¼¹çª—组件(无需返回,注册即可,但变量需返回)
      palletVisible,
      currentPalletDocNo,
      handleOpenPalletDialog,
      handlePalletBackSuccess
    };
  },
});
</script>
ÏîÄ¿´úÂë/WIDESEA_WMSClient/src/views/outbound/allocateoutboundOrder.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,443 @@
<template>
  <view-grid
    ref="grid"
        @openOutboundDialog="handleOpenOutboundDialog"
    :columns="columns"
    :detail="detail"
    :editFormFields="editFormFields"
    :editFormOptions="editFormOptions"
    :searchFormFields="searchFormFields"
    :searchFormOptions="searchFormOptions"
    :table="table"
    :extend="extend"
  >
  </view-grid>
      <!-- å‡ºåº“操作弹窗 -->
    <OutboundDialog
      v-model:visible="outboundVisible"
      :selected-document="selectedOutboundDocument"
      @outbound-success="handleOutboundSuccess"
    ></OutboundDialog>
</template>
    <script>
import extend from "@/extension/outbound/allocateoutboundOrder.js";
import ViewGrid from '@/components/basic/ViewGrid/ViewGrid.vue';
import { ref, defineComponent } from "vue";
import { ElMessage } from "element-plus";
import OutboundDialog from "@/extension/outbound/extend/OutBound.vue";  // å¼•入出库弹窗组件
export default defineComponent({
   components: {
    // å…³é”®ä¿®å¤2:组件注册名与模板标签名适配(kebab-case对应view-grid)
    viewGrid: ViewGrid,  // æ³¨å†Œä¸ºkebab-case,模板用<view-grid>
    OutboundDialog  // æ³¨å†Œå‡ºåº“弹窗组件
  },
  setup() {
    const table = ref({
      key: "id",
      footer: "Foots",
      cnName: "调拨单(外部仓库调智仓)",
      name: "outboundOrder",
      url: "/OutboundOrder/",
      sortName: "id",
    });
    const editFormFields = ref({
      orderType: "",
      orderNo:"",
      upperOrderNo: "",
      orderStatus: "",
      remark: "",
      warehouseId:""
    });
    const editFormOptions = ref([
      [
        {
          title: "单据类型",
          required: true,
          field: "orderType",
          type: "select",
          dataKey: "outOrderType",
          data: [],
        },
        {
        field: "orderNo",
        title: "单据编号",
        type: "string",
        readonly:true
      },
        {
          title: "上游单据编号",
          field: "upperOrderNo",
          type: "string",
        },
        {
          title: "单据状态",
          field: "orderStatus",
          type: "select",
          dataKey: "inboundState",
          data: [],
          readonly: true,
        },
        {
          title: "仓库",
          field: "warehouseId",
          type: "select",
          dataKey: "warehouses",
          data: [],
          required: true,
        },
        {
          title: "备注",
          field: "remark",
          type: "textarea",
        },
      ],
    ]);
    const searchFormFields = ref({
      orderNo: "",
      upperOrderNo: "",
      orderType: "215",
      orderStatus: "",
      createType: "",
      creater: "",
      createDate: "",
    });
    const searchFormOptions = ref([
      [
        { title: "单据编号", field: "orderNo", type: "like" },
        { title: "上游单据编号", field: "upperOrderNo", type: "like" },
        {
          title: "单据类型",
          field: "orderType",
          type: "select",
          dataKey: "outOrderType",
          data: [],
        },
        {
          title: "单据状态",
          field: "orderStatus",
          type: "select",
          dataKey: "outboundStatusEnum",
          data: [],
        },
      ],
      [
        {
          title: "创建方式",
          field: "createType",
          type: "select",
          dataKey: "createType",
          data: [],
        },
        { title: "创建者", field: "creater", type: "like" },
        { title: "创建时间", field: "createDate", type: "datetime" },
      ],
    ]);
    const columns = ref([
      {
        field: "id",
        title: "Id",
        type: "int",
        width: 90,
        hidden: true,
        readonly: true,
        require: true,
        align: "left",
      },
      {
        field: "orderNo",
        title: "单据编号",
        type: "string",
        width: 160,
        align: "left",
        // link: true,
      },
      {
        field: "upperOrderNo",
        title: "上游单据编号",
        type: "string",
        width: 160,
        align: "left",
      },
      {
        field: "orderType",
        title: "单据类型",
        type: "string",
        width: 150,
        align: "left",
        bind: { key: "outOrderType", data: [] },
      },
      {
        field: "businessType",
        title: "业务类型",
        type: "string",
        width: 150,
        align: "left",
        bind: { key: "businessType", data: [] },
      },
      {
        field: "orderStatus",
        title: "单据状态",
        type: "decimal",
        width: 90,
        align: "left",
        bind: { key: "outboundStatusEnum", data: [] },
      },
      {
        field: "createType",
        title: "创建方式",
        type: "string",
        width: 120,
        align: "left",
        bind: { key: "createType", data: [] },
      },
      {
        field: "factoryArea",
        title: "厂区",
        type: "string",
        width: 120,
        align: "left"
      },
      {
        field: "departmentCode",
        title: "修改时间",
        type: "string",
        width: 120,
        align: "left",
        hidden:true
      },
      {
        field: "departmentName",
        title: "部门名称",
        type: "string",
        width: 160,
        align: "left",
      },
      {
        field: "creater",
        title: "创建人",
        type: "string",
        width: 90,
        align: "left",
      },
      {
        field: "createDate",
        title: "创建时间",
        type: "datetime",
        width: 160,
        align: "left",
      },
      {
        field: "modifier",
        title: "修改人",
        type: "string",
        width: 100,
        align: "left",
      },
      {
        field: "modifyDate",
        title: "修改时间",
        type: "datetime",
        width: 160,
        align: "left",
      },
      {
        field: "remark",
        title: "备注",
        type: "string",
        width: 100,
        align: "left",
      },
    ]);
    const detail = ref({
      cnName: "调拨明细单",
      table: "OnboundOrderDetail",
      columns: [
        {
          field: "id",
          title: "Id",
          type: "int",
          width: 90,
          hidden: true,
          readonly: true,
          require: true,
          align: "left",
        },
        {
          field: "orderId",
          title: "调拨单主键",
          type: "string",
          width: 90,
          align: "left",
          hidden: true,
        },
        {
          field: "materielCode",
          title: "物料编号",
          type: "string",
          width: 150,
          align: "left",
          edit: { type: "string" },
          required: true,
        },
        {
          field: "materielName",
          title: "物料名称",
          type: "string",
          width: 150,
          align: "left",
          edit: { type: "string" },
        },
        {
          field: "batchNo",
          title: "批次号",
          type: "decimal",
          width: 90,
          align: "left",
          edit: { type: "string" },
          required: true,
        },
        {
          field: "supplyCode",
          title: "供应商编号",
          type: "string",
          width: 90,
          align: "left",
          edit: { type: "string" },
          required: true,
        },
        {
          field: "orderQuantity",
          title: "单据数量",
          type: "string",
          width: 90,
          align: "left",
          edit: { type: "number" },
          required: true,
        },
        {
          field: "rowNo",
          title: "行号",
          type: "string",
          width: 90,
          align: "left",
          edit: { type: "number" },
          required: true,
        },
        {
          field: "lockQuantity",
          title: "锁定数量",
          type: "int",
          width: 120,
          align: "left",
        },
        {
          field: "overOutQuantity",
          title: "已出数量",
          type: "string",
          width: 200,
          align: "left",
        },
        {
          field: "orderDetailStatus",
          title: "订单明细状态",
          type: "string",
          width: 180,
          align: "left",
          bind: { key: "orderDetailStatusEnum", data: [] },
        },
        {
          field: "creater",
          title: "创建人",
          type: "string",
          width: 90,
          align: "left",
        },
        {
          field: "createDate",
          title: "创建时间",
          type: "datetime",
          width: 160,
          align: "left",
        },
        {
          field: "modifier",
          title: "修改人",
          type: "string",
          width: 100,
          align: "left",
        },
        {
          field: "modifyDate",
          title: "修改时间",
          type: "datetime",
          width: 160,
          align: "left",
        },
        {
          field: "remark",
          title: "备注",
          type: "string",
          width: 100,
          align: "left",
        },
      ],
      sortName: "id",
      key: "id",
    });
      // è°ƒæ‹¨å¼¹çª—相关
    const outboundVisible = ref(false);
    const selectedOutboundDocument = ref({});  // å­˜å‚¨é€‰ä¸­çš„调拨单数据
    // æ‰“开调拨弹窗(从扩展配置的按钮事件触发)
    const handleOpenOutboundDialog = (docData) => {
      selectedOutboundDocument.value = docData;  // ä¿å­˜é€‰ä¸­çš„单据数据
      outboundVisible.value = true;  // æ˜¾ç¤ºå¼¹çª—
    };
    // è°ƒæ‹¨æˆåŠŸåŽçš„å›žè°ƒ
    const handleOutboundSuccess = (docNo) => {
      ElMessage.success(`单据 ${docNo} è°ƒæ‹¨æˆåŠŸ`);
      gridRef.value?.refresh();  // åˆ·æ–°è¡¨æ ¼æ•°æ®
    };
    // åˆå§‹åŒ–扩展配置:为调拨按钮添加事件触发逻辑
    const initExtension = () => {
      // æ‰¾åˆ°"调拨"按钮并绑定打开弹窗的逻辑
      const outboundBtn = extend.buttons.view.find(btn => btn.name === '出库');
      if (outboundBtn) {
        const originalOnClick = outboundBtn.onClick;
        outboundBtn.onClick = function() {
          // å…ˆæ‰§è¡ŒåŽŸæœ‰æ ¡éªŒé€»è¾‘
          const selectedRows = this.$refs.table.getSelected();
          if (selectedRows.length === 1) {
            // æ ¡éªŒé€šè¿‡åŽï¼Œè§¦å‘主组件的出库弹窗事件
            this.$emit('openOutboundDialog', selectedRows[0]);
          } else {
            // åŽŸæœ‰é€»è¾‘å·²å¤„ç†æç¤ºï¼Œæ— éœ€é‡å¤
            originalOnClick.call(this);
          }
        };
      }
    };
    return {
      table,
      extend,
      editFormFields,
      editFormOptions,
      searchFormFields,
      searchFormOptions,
      columns,
      detail,
       // å‡ºåº“相关
      outboundVisible,
      selectedOutboundDocument,
      handleOpenOutboundDialog,
      handleOutboundSuccess
    };
  },
});
</script>
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_BasicService/InvokeMESService.cs
@@ -12,6 +12,7 @@
using System.Threading.Tasks;
using WIDESEA_Core;
using WIDESEA_Core.BaseRepository;
using WIDESEA_DTO.Allocate;
using WIDESEA_DTO.Basic;
using WIDESEA_DTO.Inbound;
using WIDESEA_DTO.Outbound;
@@ -41,6 +42,12 @@
            _inboundOrderRepository = inboundOrderRepository;
        }
        /// <summary>
        /// å…¥åº“反馈
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        /// <exception cref="HttpRequestException"></exception>
        public async Task<ResponseModel> FeedbackInbound(FeedbackInboundRequestModel model)
        {
            string json =JsonConvert.SerializeObject(model, new JsonSerializerSettings
@@ -63,7 +70,13 @@
            return JsonConvert.DeserializeObject<ResponseModel>(body);
        }
        /// <summary>
        /// å‡ºåº“反馈
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        /// <exception cref="HttpRequestException"></exception>
        public async Task<ResponseModel> FeedbackOutbound(FeedbackOutboundRequestModel model)
        {
            string json = JsonConvert.SerializeObject(model, new JsonSerializerSettings
@@ -90,6 +103,29 @@
            return JsonConvert.DeserializeObject<ResponseModel>(body);
        }
        public async Task<ResponseModel> FeedbackAllocate(AllocateDto model)
        {
            string json = JsonConvert.SerializeObject(model, new JsonSerializerSettings
            {
                ContractResolver = new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver()
            });
            var content = new StringContent(json, Encoding.UTF8, "application/json");
            var _client = _httpClientFactory.CreateClient("MESUrl");
            _client.DefaultRequestHeaders.Clear();
            _client.DefaultRequestHeaders.Add("Accept", "application/json");
            _logger.LogInformation("InvokeMESService  FeedbackAllocate :  " + json);
            var response = await _client.PostAsync("AldAllocationOperation/AllocationOperation", content);
            string body = await response.Content.ReadAsStringAsync();
            _logger.LogInformation("InvokeMESService  FeedbackAllocate  body:  " + body);
            if (!response.IsSuccessStatusCode)
            {
                throw new HttpRequestException(body);
            }
            return JsonConvert.DeserializeObject<ResponseModel>(body);
        }
        public async Task<ResponseModel> NewMaterielToMes(MaterielToMesDTO model)
        {
            string json = JsonConvert.SerializeObject(model, new JsonSerializerSettings
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_Common/StockEnum/StockStatusEmun.cs
@@ -58,7 +58,7 @@
        [Description("入库确认")]
        å…¥åº“确认 = 3,
        [Description("入库完成")]
        å…¥åº“完成 = 6,
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_DTO/Allocate/AllocateDto.cs
@@ -25,7 +25,7 @@
        /// è¯·æ±‚æ—¶é—´
        /// </summary>
        [JsonProperty("reqTime")]
        public DateTime ReqTime { get; set; }
        public string ReqTime { get; set; }
        /// <summary>
        /// è®¢å•编号
@@ -39,6 +39,10 @@
        [JsonProperty("business_type")]
        public string BusinessType { get; set; }
        public string fromWarehouse { get; set; }
        public string toWarehouse { get; set; }
        /// <summary>
        /// æ˜¯å¦åˆ†æ‰¹
        /// </summary>
@@ -51,6 +55,9 @@
        [JsonProperty("factoryArea")]
        public string FactoryArea { get; set; }
        [JsonProperty("operator")]
        public string Operator { get; set; }
        /// <summary>
        /// æ“ä½œç±»åž‹
        /// </summary>
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_IBasicService/IInvokeMESService.cs
@@ -4,6 +4,7 @@
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Core;
using WIDESEA_DTO.Allocate;
using WIDESEA_DTO.Basic;
using WIDESEA_DTO.Inbound;
using WIDESEA_DTO.Outbound;
@@ -16,6 +17,7 @@
        Task<ResponseModel> FeedbackOutbound(FeedbackOutboundRequestModel model);
        Task<ResponseModel> FeedbackAllocate(AllocateDto model);
        Task<string> GetToken(String username, string password);
        Task<ResponseModel> NewMaterielToMes(MaterielToMesDTO model);
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundPickingService.cs
@@ -148,7 +148,13 @@
        }
        #region æ ¸å¿ƒä¸šåŠ¡æµç¨‹
        /// <summary>
        /// æ‹£é€‰
        /// </summary>
        /// <param name="orderNo"></param>
        /// <param name="palletCode"></param>
        /// <param name="barcode"></param>
        /// <returns></returns>
        public async Task<WebResponseContent> ConfirmPicking(string orderNo, string palletCode, string barcode)
        {
            try
@@ -189,11 +195,21 @@
                return WebResponseContent.Instance.Error($"拣选确认失败:{ex.Message}");
            }
        }
        /// <summary>
        /// å–消拣选
        /// </summary>
        /// <param name="orderNo"></param>
        /// <param name="palletCode"></param>
        /// <param name="barcode"></param>
        /// <returns></returns>
        public async Task<WebResponseContent> CancelPicking(string orderNo, string palletCode, string barcode)
        {
            try
            {
                if (await IsPalletReturned(palletCode))
                {
                    return WebResponseContent.Instance.Error($"托盘{palletCode}已经回库,不能取消分拣");
                }
                _unitOfWorkManage.BeginTran();
                // 1. å‰ç½®éªŒè¯
@@ -217,7 +233,13 @@
                return WebResponseContent.Instance.Error($"取消分拣失败:{ex.Message}");
            }
        }
        /// <summary>
        /// å›žåº“
        /// </summary>
        /// <param name="orderNo"></param>
        /// <param name="palletCode"></param>
        /// <param name="reason"></param>
        /// <returns></returns>
        public async Task<WebResponseContent> ReturnRemaining(string orderNo, string palletCode, string reason)
        {
            try
@@ -229,8 +251,7 @@
                    return WebResponseContent.Instance.Error("订单号和托盘码不能为空");
                // 2. èŽ·å–åº“å­˜å’Œä»»åŠ¡ä¿¡æ¯
                var stockInfo = await _stockInfoService.Db.Queryable<Dt_StockInfo>()
                    .FirstAsync(x => x.PalletCode == palletCode);
                var stockInfo = await _stockInfoService.Db.Queryable<Dt_StockInfo>().FirstAsync(x => x.PalletCode == palletCode);
                if (stockInfo == null)
                    return WebResponseContent.Instance.Error($"未找到托盘 {palletCode} å¯¹åº”的库存信息");
@@ -242,7 +263,7 @@
                // 3. åˆ†æžéœ€è¦å›žåº“的货物
                var returnAnalysis = await AnalyzeReturnItems(orderNo, palletCode, stockInfo.Id);
                if (!returnAnalysis.HasItemsToReturn)
                    return await HandleNoReturnItems(orderNo, palletCode);
                    return await HandleNoReturnItems(orderNo, palletCode,task);
                // 4. æ‰§è¡Œå›žåº“操作
                await ExecuteReturnOperations(orderNo, palletCode, stockInfo, task, returnAnalysis);
@@ -301,7 +322,8 @@
            // 6. èŽ·å–åº“å­˜æ˜Žç»†
            var stockDetail = await _stockInfoDetailService.Db.Queryable<Dt_StockInfoDetail>()
                .Where(x => x.Barcode == barcode && x.StockId == lockInfo.StockId)
                .Where(x => x.Barcode == barcode && x.StockId == lockInfo.StockId &&
                   x.Status != StockStatusEmun.入库确认.ObjToInt())
                .FirstAsync();
            if (stockDetail == null)
@@ -333,18 +355,13 @@
                           it.Status == (int)OutLockStockStatusEnum.出库中 &&
                           it.PalletCode == palletCode &&
                           it.CurrentBarcode == barcode &&
                           it.AssignQuantity > it.PickedQty)
                .FirstAsync();
                           it.AssignQuantity > it.PickedQty).FirstAsync();
            if (lockInfo == null)
            {
                // æŸ¥æ‰¾åŒä¸€è®¢å•下的记录
                lockInfo = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>()
                    .Where(it => it.OrderNo == orderNo &&
                               it.CurrentBarcode == barcode &&
                               it.Status == (int)OutLockStockStatusEnum.出库中 &&
                               it.AssignQuantity > it.PickedQty)
                    .FirstAsync();
                    .Where(it => it.OrderNo == orderNo &&  it.CurrentBarcode == barcode && it.Status == (int)OutLockStockStatusEnum.出库中 && it.AssignQuantity > it.PickedQty).FirstAsync();
                if (lockInfo == null)
                {
@@ -352,8 +369,7 @@
                    var completedLockInfo = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>()
                        .Where(it => it.CurrentBarcode == barcode &&
                                   (it.Status == (int)OutLockStockStatusEnum.拣选完成 ||
                                    it.PickedQty >= it.AssignQuantity))
                        .FirstAsync();
                                    it.PickedQty >= it.AssignQuantity)).FirstAsync();
                    if (completedLockInfo != null)
                        throw new Exception($"条码{barcode}已经完成分拣,不能重复分拣");
@@ -596,6 +612,20 @@
            if (lockInfo.Status != (int)OutLockStockStatusEnum.拣选完成)
                return ValidationResult<(Dt_PickingRecord, Dt_OutStockLockInfo, Dt_OutboundOrderDetail)>.Error("当前状态不允许取消分拣");
            var stockDetail = await _stockInfoDetailService.Db.Queryable<Dt_StockInfoDetail>()
       .Where(it => it.Barcode == barcode && it.StockId == pickingRecord.StockId)
       .FirstAsync();
            if (stockDetail != null)
            {
                // æ£€æŸ¥åº“存状态 - å¦‚果状态是入库确认或入库完成,说明已经回库
                if (stockDetail.Status == StockStatusEmun.入库确认.ObjToInt() ||
                    stockDetail.Status == StockStatusEmun.入库完成.ObjToInt())
                {
                    return ValidationResult<(Dt_PickingRecord, Dt_OutStockLockInfo, Dt_OutboundOrderDetail)>.Error($"条码{barcode}已经回库,不能取消分拣");
                }
            }
            // æ£€æŸ¥è®¢å•状态
            var order = await _outboundOrderService.Db.Queryable<Dt_OutboundOrder>()
                .Where(x => x.OrderNo == orderNo)
@@ -613,13 +643,54 @@
            return ValidationResult<(Dt_PickingRecord, Dt_OutStockLockInfo, Dt_OutboundOrderDetail)>.Success((pickingRecord, lockInfo, orderDetail));
        }
        /// <summary>
        /// æ£€æŸ¥æ¡ç æ˜¯å¦å·²ç»å›žåº“
        /// </summary>
        private async Task<bool> IsBarcodeReturned(string barcode, int stockId)
        {
            var stockDetail = await _stockInfoDetailService.Db.Queryable<Dt_StockInfoDetail>()
                .Where(it => it.Barcode == barcode && it.StockId == stockId)
                .FirstAsync();
            if (stockDetail == null)
                return false;
            // å¦‚果状态是入库确认或入库完成,说明已经回库
            return stockDetail.Status == StockStatusEmun.入库确认.ObjToInt() ||
                   stockDetail.Status == StockStatusEmun.入库完成.ObjToInt();
        }
        /// <summary>
        /// æ£€æŸ¥é”å®šä¿¡æ¯å¯¹åº”的条码是否已经回库
        /// </summary>
        private async Task<bool> IsLockInfoReturned(Dt_OutStockLockInfo lockInfo)
        {
            var stockDetail = await _stockInfoDetailService.Db.Queryable<Dt_StockInfoDetail>()
                .Where(it => it.Barcode == lockInfo.CurrentBarcode && it.StockId == lockInfo.StockId)
                .FirstAsync();
            if (stockDetail == null)
                return false;
            return stockDetail.Status == StockStatusEmun.入库确认.ObjToInt() ||
                   stockDetail.Status == StockStatusEmun.入库完成.ObjToInt();
        }
        private async Task ExecuteCancelLogic(Dt_OutStockLockInfo lockInfo, Dt_PickingRecord pickingRecord,
            Dt_OutboundOrderDetail orderDetail, string orderNo)
        {
            decimal cancelQty = pickingRecord.PickQuantity;
            // 1. æ£€æŸ¥å–消后数量不会为负数
            var currentStockDetail = await _stockInfoDetailService.Db.Queryable<Dt_StockInfoDetail>()
        .Where(it => it.Barcode == pickingRecord.Barcode && it.StockId == pickingRecord.StockId)
        .FirstAsync();
            if (currentStockDetail != null &&
                (currentStockDetail.Status == StockStatusEmun.入库确认.ObjToInt() ||
                 currentStockDetail.Status == StockStatusEmun.入库完成.ObjToInt()))
            {
                throw new Exception($"条码{pickingRecord.Barcode}已经回库,无法取消分拣");
            }
            //   æ£€æŸ¥å–消后数量不会为负数
            decimal newOverOutQuantity = orderDetail.OverOutQuantity - cancelQty;
            decimal newPickedQty = orderDetail.PickedQty - cancelQty;
@@ -628,7 +699,7 @@
                throw new Exception($"取消分拣将导致数据异常:已出库{newOverOutQuantity},已拣选{newPickedQty}");
            }
            // 2. å¤„理不同类型的取消
            //  å¤„理不同类型的取消
            if (lockInfo.IsSplitted == 1 && lockInfo.ParentLockId.HasValue)
            {
                await HandleSplitBarcodeCancel(lockInfo, pickingRecord, cancelQty);
@@ -638,15 +709,15 @@
                await HandleNormalBarcodeCancel(lockInfo, pickingRecord, cancelQty);
            }
            // 3. æ›´æ–°è®¢å•明细
            // æ›´æ–°è®¢å•明细
            await UpdateOrderDetailOnCancel(pickingRecord.OrderDetailId, cancelQty);
            // 4. åˆ é™¤æ‹£é€‰è®°å½•
            //  åˆ é™¤æ‹£é€‰è®°å½•
            await Db.Deleteable<Dt_PickingRecord>()
                .Where(x => x.Id == pickingRecord.Id)
                .ExecuteCommandAsync();
            // 5. é‡æ–°æ£€æŸ¥è®¢å•状态
            //  é‡æ–°æ£€æŸ¥è®¢å•状态
            await UpdateOrderStatusForReturn(orderNo);
        }
@@ -660,6 +731,14 @@
            if (parentLockInfo == null)
                throw new Exception("未找到父锁定信息,无法取消拆包分拣");
            if (await IsLockInfoReturned(parentLockInfo))
            {
                throw new Exception($"父条码{parentLockInfo.CurrentBarcode}已经回库,无法取消拆包分拣");
            }
            if (await IsLockInfoReturned(lockInfo))
            {
                throw new Exception($"拆包条码{lockInfo.CurrentBarcode}已经回库,无法取消拆包分拣");
            }
            // æ¢å¤çˆ¶é”å®šä¿¡æ¯çš„分配数量
            parentLockInfo.AssignQuantity += cancelQty;
            await _outStockLockInfoService.Db.Updateable(parentLockInfo).ExecuteCommandAsync();
@@ -695,6 +774,10 @@
        private async Task HandleNormalBarcodeCancel(Dt_OutStockLockInfo lockInfo, Dt_PickingRecord pickingRecord, decimal cancelQty)
        {
            if (await IsLockInfoReturned(lockInfo))
            {
                throw new Exception($"条码{lockInfo.CurrentBarcode}已经回库,无法取消分拣");
            }
            // æ¢å¤é”å®šä¿¡æ¯
            lockInfo.PickedQty -= cancelQty;
            if (lockInfo.PickedQty < 0) lockInfo.PickedQty = 0;
@@ -750,7 +833,22 @@
            return await _stockInfoService.Db.Queryable<Dt_StockInfo>()
                .FirstAsync(x => x.PalletCode == palletCode);
        }
        /// <summary>
        /// æ£€æŸ¥æ•´ä¸ªæ‰˜ç›˜æ˜¯å¦å·²ç»å›žåº“
        /// </summary>
        private async Task<bool> IsPalletReturned(string palletCode)
        {
            var stockInfo = await _stockInfoService.Db.Queryable<Dt_StockInfo>()
                .Where(x => x.PalletCode == palletCode)
                .FirstAsync();
            if (stockInfo == null)
                return false;
            // å¦‚果托盘状态是入库确认或入库完成,说明已经回库
            return stockInfo.StockStatus == StockStatusEmun.入库确认.ObjToInt() ||
                   stockInfo.StockStatus == StockStatusEmun.入库完成.ObjToInt();
        }
        private async Task<Dt_Task> GetCurrentTask(string orderNo, string palletCode)
        {
            // å…ˆå°è¯•通过订单号和托盘号查找任务
@@ -805,7 +903,7 @@
            // æƒ…况3:检查拆包记录
            var splitRecords = await _splitPackageService.Db.Queryable<Dt_SplitPackageRecord>()
                .Where(it => it.OrderNo == orderNo && it.PalletCode == palletCode && !it.IsReverted)
                .Where(it => it.OrderNo == orderNo && it.PalletCode == palletCode && !it.IsReverted && it.Status != (int)SplitPackageStatusEnum.已回库)
                .ToListAsync();
            if (splitRecords.Any())
@@ -860,7 +958,7 @@
            return totalQty;
        }
        private async Task<WebResponseContent> HandleNoReturnItems(string orderNo, string palletCode)
        private async Task<WebResponseContent> HandleNoReturnItems(string orderNo, string palletCode,Dt_Task originalTask)
        {
            // æ£€æŸ¥æ˜¯å¦æ‰€æœ‰è´§ç‰©éƒ½å·²æ‹£é€‰å®Œæˆ
            var allPicked = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>()
@@ -869,12 +967,18 @@
            if (allPicked)
            {
                // åˆ é™¤åŽŸå§‹å‡ºåº“ä»»åŠ¡
                await _taskRepository.Db.Deleteable(originalTask).ExecuteCommandAsync();
                return WebResponseContent.Instance.OK("所有货物已拣选完成,托盘为空");
            }
            else
            {
                // åˆ é™¤åŽŸå§‹å‡ºåº“ä»»åŠ¡
                await _taskRepository.Db.Deleteable(originalTask).ExecuteCommandAsync();
                return WebResponseContent.Instance.Error("没有需要回库的剩余货物");
            }
            //空托盘如何处理  è¿˜æœ‰ä¸€ä¸ªå‡ºåº“任务要处理。
        }
        private async Task ExecuteReturnOperations(string orderNo, string palletCode, Dt_StockInfo stockInfo,
@@ -932,7 +1036,7 @@
                {
                    // æ¢å¤åº“存状态
                    stockDetail.OutboundQuantity = Math.Max(0, stockDetail.OutboundQuantity - returnQty);
                    stockDetail.Status = StockStatusEmun.入库完成.ObjToInt();
                    stockDetail.Status = StockStatusEmun.入库确认.ObjToInt();
                    await _stockInfoDetailService.Db.Updateable(stockDetail).ExecuteCommandAsync();
                }
                else
@@ -949,7 +1053,7 @@
                        OutboundQuantity = 0,
                        Barcode = lockInfo.CurrentBarcode,
                        InboundOrderRowNo = "",
                        Status = StockStatusEmun.入库完成.ObjToInt(),
                        Status = StockStatusEmun.入库确认.ObjToInt(),
                        SupplyCode = lockInfo.SupplyCode,
                        WarehouseCode = lockInfo.WarehouseCode,
                        Unit = lockInfo.Unit,
@@ -997,7 +1101,7 @@
            {
                // æ¢å¤åº“存状态
                stockGood.OutboundQuantity = 0;
                stockGood.Status = StockStatusEmun.入库完成.ObjToInt();
                stockGood.Status = StockStatusEmun.入库确认.ObjToInt();
                await _stockInfoDetailService.Db.Updateable(stockGood).ExecuteCommandAsync();
            }
@@ -1018,10 +1122,17 @@
        private async Task UpdateStockInfoStatus(Dt_StockInfo stockInfo)
        {
            // æ›´æ–°åº“存主表状态
            stockInfo.StockStatus = StockStatusEmun.入库完成.ObjToInt();
            stockInfo.StockStatus = StockStatusEmun.入库确认.ObjToInt();
            await _stockInfoService.Db.Updateable(stockInfo).ExecuteCommandAsync();
        }
        /// <summary>
        /// åˆ›å»ºå›žåº“任务
        /// </summary>
        /// <param name="orderNo"></param>
        /// <param name="palletCode"></param>
        /// <param name="originalTask"></param>
        /// <param name="analysis"></param>
        /// <returns></returns>
        private async Task CreateReturnTaskAndHandleESS(string orderNo, string palletCode, Dt_Task originalTask, ReturnAnalysisResult analysis)
        {
            var firstLocation = await _locationInfoService.Db.Queryable<Dt_LocationInfo>()
@@ -1056,7 +1167,14 @@
            // ç»™ ESS å‘送流动信号和创建任务
            await SendESSCommands(palletCode, targetAddress, returnTask);
        }
        /// <summary>
        /// ç»™ESS下任务
        /// </summary>
        /// <param name="palletCode"></param>
        /// <param name="targetAddress"></param>
        /// <param name="returnTask"></param>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        private async Task SendESSCommands(string palletCode, string targetAddress, Dt_Task returnTask)
        {
            try
@@ -1385,15 +1503,30 @@
        private WebResponseContent CreatePickingResponse(PickingResult result, string adjustedReason)
        {
            //if (result.SplitResults.Any())
            //{
            //    var responseData = new { SplitResults = result.SplitResults, AdjustedReason = "" };
            //    if (!string.IsNullOrEmpty(adjustedReason))
            //    {
            //        responseData = new { SplitResults = result.SplitResults, AdjustedReason = adjustedReason };
            //    }
            //    return WebResponseContent.Instance.OK("拣选确认成功,已自动拆包", responseData);
            //}
            //if (!string.IsNullOrEmpty(adjustedReason))
            //{
            //    return WebResponseContent.Instance.OK($"拣选确认成功({adjustedReason})");
            //}
            //return WebResponseContent.Instance.OK("拣选确认成功");
            if (result.SplitResults.Any())
            {
                return WebResponseContent.Instance.OK("拣选确认成功,已自动拆包", new { SplitResults = result.SplitResults });
            }
            return WebResponseContent.Instance.OK("拣选确认成功", new { SplitResults = new List<SplitResult>() });
        }
        #endregion
    }
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
@@ -38,9 +38,11 @@
using WIDESEA_Core.BaseServices;
using WIDESEA_Core.Enums;
using WIDESEA_Core.Helper;
using WIDESEA_DTO.Allocate;
using WIDESEA_DTO.Basic;
using WIDESEA_DTO.Inbound;
using WIDESEA_DTO.Task;
using WIDESEA_IAllocateService;
using WIDESEA_IBasicService;
using WIDESEA_IInboundService;
using WIDESEA_IOutboundService;
@@ -69,7 +71,7 @@
        private readonly IESSApiService _eSSApiService;
        private readonly IStockService _stockService;
        private readonly IRecordService _recordService;
        private readonly IAllocateService _allocateService;
        private readonly IInvokeMESService _invokeMESService;
        public IRepository<Dt_Task> Repository => BaseDal;
@@ -90,7 +92,7 @@
        public List<int> TaskOutboundTypes => typeof(TaskTypeEnum).GetEnumIndexList();
        public TaskService(IRepository<Dt_Task> BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_StockInfo> stockRepository, ILocationInfoService locationInfoService, IInboundOrderService inboundOrderService, ILocationStatusChangeRecordService locationStatusChangeRecordService, IESSApiService eSSApiService, ILogger<TaskService> logger, IStockService stockService, IRecordService recordService, IInboundOrderDetailService inboundOrderDetailService, IOutboundOrderService outboundOrderService, IOutboundOrderDetailService outboundOrderDetailService, IInvokeMESService invokeMESService, IOutStockLockInfoService outStockLockInfoService) : base(BaseDal)
        public TaskService(IRepository<Dt_Task> BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_StockInfo> stockRepository, ILocationInfoService locationInfoService, IInboundOrderService inboundOrderService, ILocationStatusChangeRecordService locationStatusChangeRecordService, IESSApiService eSSApiService, ILogger<TaskService> logger, IStockService stockService, IRecordService recordService, IInboundOrderDetailService inboundOrderDetailService, IOutboundOrderService outboundOrderService, IOutboundOrderDetailService outboundOrderDetailService, IInvokeMESService invokeMESService, IOutStockLockInfoService outStockLockInfoService, IAllocateService allocateService) : base(BaseDal)
        {
            _mapper = mapper;
            _unitOfWorkManage = unitOfWorkManage;
@@ -107,6 +109,7 @@
            _outboundOrderDetailService = outboundOrderDetailService;
            _invokeMESService = invokeMESService;
            _outStockLockInfoService = outStockLockInfoService;
            _allocateService = allocateService;
        }
@@ -250,7 +253,53 @@
                {
                    if (inboundOrder.OrderType == InOrderTypeEnum.Allocat.ObjToInt())//调拨入库
                    {
                        if (inboundOrder != null && inboundOrder.OrderStatus == InOrderStatusEnum.入库完成.ObjToInt())
                        {
                            var allocate = _allocateService.Repository.QueryData(x => x.OrderNo == inboundOrder.InboundOrderNo).First();
                            var feedmodel = new AllocateDto
                            {
                                ReqCode = Guid.NewGuid().ToString(),
                                ReqTime = DateTime.Now.ToString(),
                                BusinessType = "2",
                                FactoryArea = inboundOrder.FactoryArea,
                                OperationType = 1,
                                Operator = inboundOrder.Operator,
                                OrderNo = inboundOrder.UpperOrderNo,
                                fromWarehouse = allocate?.FromWarehouse??"",
                                toWarehouse = allocate?.ToWarehouse??"",
                                Details = new List<AllocateDtoDetail>()
                            };
                            var groupedData = inboundOrder.Details.GroupBy(item => new { item.MaterielCode, item.SupplyCode, item.BatchNo, item.lineNo, item.BarcodeUnit, item.WarehouseCode })
                               .Select(group => new AllocateDtoDetail
                               {
                                   MaterialCode = group.Key.MaterielCode,
                                   LineNo = group.Key.lineNo,
                                   WarehouseCode = group.Key.WarehouseCode,
                                   Qty = group.Sum(x => x.BarcodeQty),
                                   // warehouseCode= "1072",
                                   Unit = group.Key.BarcodeUnit,
                                   Barcodes = group.Select(row => new BarcodeInfo
                                   {
                                       Barcode = row.Barcode,
                                       Qty = row.BarcodeQty,
                                       BatchNo = row.BatchNo,
                                       SupplyCode = row.SupplyCode,
                                       Unit = row.Unit
                                   }).ToList()
                               }).ToList();
                            feedmodel.Details = groupedData;
                            var result = await _invokeMESService.FeedbackAllocate(feedmodel);
                            if (result != null && result.code == 200)
                            {
                                _inboundOrderService.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = 1 })
                                .Where(it => it.Id == inboundOrder.Id).ExecuteCommand();
                                _inboundOrderDetailService.Db.Updateable<Dt_InboundOrderDetail>().SetColumns(it => new Dt_InboundOrderDetail { ReturnToMESStatus = 1 })
                                .Where(it => it.OrderId == inboundOrder.Id).ExecuteCommand();
                            }
                        }
                    }
                    else if (inboundOrder.OrderType == InOrderTypeEnum.ReCheck.ObjToInt()) //重检入库
                    {
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_TaskInfoService/WIDESEA_TaskInfoService.csproj
@@ -7,6 +7,7 @@
  </PropertyGroup>
  <ItemGroup>
    <ProjectReference Include="..\WIDESEA_IAllocateService\WIDESEA_IAllocateService.csproj" />
    <ProjectReference Include="..\WIDESEA_IBasicService\WIDESEA_IBasicService.csproj" />
    <ProjectReference Include="..\WIDESEA_IInboundService\WIDESEA_IInboundService.csproj" />
    <ProjectReference Include="..\WIDESEA_IOutboundService\WIDESEA_IOutboundService.csproj" />
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Allocate/AllocateOrderController.cs
@@ -3,6 +3,7 @@
using System.Data.Common;
using System.Diagnostics.Eventing.Reader;
using System.Threading.Tasks;
using WIDESEA_Common.AllocateEnum;
using WIDESEA_Core;
using WIDESEA_Core.Attributes;
using WIDESEA_Core.BaseController;
@@ -36,15 +37,23 @@
            {
                OrderNo = model.OrderNo,
                UpperOrderNo = model.OrderNo,
                BusinessType=model.BusinessType,
                FactoryArea=model.FactoryArea,
                IsBatch=model.IsBatch,
                BusinessType = model.BusinessType,
                FactoryArea = model.FactoryArea,
                IsBatch = model.IsBatch,
                CreateType = model.OperationType,
                Details = new List<Dt_AllocateOrderDetail>()
                FromWarehouse=model.fromWarehouse,
                ToWarehouse=model.toWarehouse,
                Details = new List<Dt_AllocateOrderDetail>()
            };
            Enum.TryParse<BusinessTypeEnum>(allocateOrder.BusinessType, out var businessType);
            foreach (var detailDto in model.Details)
            {
                if (businessType == BusinessTypeEnum.智仓调外部仓库 && (detailDto.Barcodes == null || !detailDto.Barcodes.Any()))
                {
                    return WebResponseContent.Instance.Error($"条码不能为空");
                }
                if (detailDto.Barcodes != null && detailDto.Barcodes.Any())
                {
                    foreach (var barcodeDto in detailDto.Barcodes)
@@ -55,7 +64,7 @@
                            MaterielCode = detailDto.MaterialCode,
                            LineNo = detailDto.LineNo,
                            OrderQuantity = detailDto.Qty,
                            SupplyCode= barcodeDto.SupplyCode,
                            SupplyCode = barcodeDto.SupplyCode,
                            Unit = detailDto.Unit,
                            Barcode = barcodeDto.Barcode,
                            BatchNo = barcodeDto.BatchNo,
@@ -79,7 +88,7 @@
                }
                allocateOrder.Details.AddRange(allocateOrder.Details);
            }
            var content =await Service.ReceiveAllocateOrder(allocateOrder, model.OperationType);
            var content = await Service.ReceiveAllocateOrder(allocateOrder, model.OperationType);
            if (content.Status) return WebResponseContent.Instance.OK(200);
            else return WebResponseContent.Instance.Error(content.Message);