1
huangxiaoqiang
2025-12-19 7f2db05b4ce84051d9c0a5c89a62185211b8442b
1
已添加2个文件
已修改15个文件
734 ■■■■ 文件已修改
项目代码/WIDESEA_WMSClient/config/buttons.js 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WIDESEA_WMSClient/src/api/http.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WIDESEA_WMSClient/src/extension/inbound/inboundOrder.js 474 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WIDESEA_WMSClient/src/views/inbound/inboundOrder.vue 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.1231.31060/CodeChunks.db 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.1231.31060/CodeChunks.db-shm 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.1231.31060/CodeChunks.db-wal 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.1231.31060/SemanticSymbols.db 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.1231.31060/SemanticSymbols.db-shm 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.1231.31060/SemanticSymbols.db-wal 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_DTO/Allocate/AllocateDto.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_IInboundService/IInboundService.cs 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_InboundService/InboundService.cs 216 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_Model/Models/Inbound/Dt_InboundOrderDetail.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Inbound/InboundController.cs 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目资料/接口文档/~$S接口对接文档_V1.04.doc 补丁 | 查看 | 原始文档 | blame | 历史
项目资料/接口文档/~$es接口文档.docx 补丁 | 查看 | 原始文档 | blame | 历史
ÏîÄ¿´úÂë/WIDESEA_WMSClient/config/buttons.js
@@ -242,7 +242,15 @@
    type: 'primary',
    onClick: function () {
    }
},
},{
    name: "分批入库回传MES",
    // icon: 'el-icon-upload2',
    class: '',
    value: 'BatchInOrderFeedbackToMes',
    type: 'primary',
    onClick: function () {
    }
}
]
export default buttons
ÏîÄ¿´úÂë/WIDESEA_WMSClient/src/api/http.js
@@ -13,8 +13,8 @@
let loadingInstance;
let loadingStatus = false;
if (process.env.NODE_ENV == 'development') {
    // axios.defaults.baseURL = 'http://127.0.0.1:9291/';
    axios.defaults.baseURL = window.webConfig.webApiBaseUrl;
    axios.defaults.baseURL = 'http://127.0.0.1:9291/';
    // axios.defaults.baseURL = window.webConfig.webApiBaseUrl;
}
else if (process.env.NODE_ENV == 'debug') {
    axios.defaults.baseURL = 'http://127.0.0.1:8098/';
ÏîÄ¿´úÂë/WIDESEA_WMSClient/src/extension/inbound/inboundOrder.js
@@ -1,36 +1,45 @@
//此js文件是用来自定义扩展业务代码,可以扩展一些自定义页面或者重新配置生成的代码
import gridHeader from './extend/EmptyTrayInbound.vue'
import gridBody from './extend/Pallet.vue'
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 gridHeader from "./extend/EmptyTrayInbound.vue";
import gridBody from "./extend/Pallet.vue";
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";
let extension = {
  components: {
    //查询界面扩展组件
    gridHeader: gridHeader,
    gridBody: gridBody,
    gridFooter: '',
    gridFooter: "",
    //新建、编辑弹出框扩展组件
    modelHeader: '',
    modelBody: '',
    modelFooter: ''
    modelHeader: "",
    modelBody: "",
    modelFooter: "",
  },
  tableAction: '', //指定某张表的权限(这里填写表名,默认不用填写)
  tableAction: "", //指定某张表的权限(这里填写表名,默认不用填写)
  buttons: {
    view: [
      {
        name: '撤销组盘',
        type: 'primary',
        value: '撤销组盘',
        onClick: function () {
          console.log('撤销组盘按钮被点击');
          const mountNode = document.createElement('div');
        name: "撤销组盘",
        type: "primary",
        value: "撤销组盘",
        onClick: function() {
          console.log("撤销组盘按钮被点击");
          const mountNode = document.createElement("div");
          document.body.appendChild(mountNode);
          // å“åº”式表单数据:托盘号(必填)
          const formData = reactive({
            palletCode: '', // æ‰˜ç›˜å·è¾“入框
            barcode: ''
            palletCode: "", // æ‰˜ç›˜å·è¾“入框
            barcode: "",
          });
          // æäº¤è¡¨å•的统一逻辑
@@ -40,13 +49,18 @@
              // æ‰§è¡Œè¡¨å•校验(托盘号必填)
              await formRef.validate();
            } catch (err) {
              ElMessage.warning('请输入有效的托盘号');
              ElMessage.warning("请输入有效的托盘号");
              return;
            }
            // å‘起撤销组盘请求
            try {
              const response = await http.post('/api/InboundOrder/UndoPalletGroup?palletCode=' + formData.palletCode.trim() + '&barcode=' + formData.barcode.trim());
              const response = await http.post(
                "/api/InboundOrder/UndoPalletGroup?palletCode=" +
                  formData.palletCode.trim() +
                  "&barcode=" +
                  formData.barcode.trim()
              );
              const { status, message, data } = response;
              if (status) {
                ElMessage.success(response.message);
@@ -55,12 +69,12 @@
                render(null, mountNode);
                document.body.removeChild(mountNode);
              } else {
                ElMessage.error(message || data?.message || '撤销组盘失败');
                ElMessage.error(message || data?.message || "撤销组盘失败");
                selectPalletCodeInput(); // é€‰ä¸­è¾“入框方便重新输入
              }
            } catch (error) {
              console.error('撤销组盘请求异常:', error);
              ElMessage.error('网络异常或接口错误,请稍后重试');
              console.error("撤销组盘请求异常:", error);
              ElMessage.error("网络异常或接口错误,请稍后重试");
              selectPalletCodeInput();
            }
          };
@@ -70,7 +84,8 @@
            setTimeout(() => {
              const inputRef = vnode.component.refs.palletCodeInput;
              if (inputRef) {
                const targetInput = inputRef.$el?.querySelector('input') || inputRef;
                const targetInput =
                  inputRef.$el?.querySelector("input") || inputRef;
                targetInput?.focus();
                targetInput?.select();
              }
@@ -78,180 +93,277 @@
          };
          // åˆ›å»ºå¯¹è¯æ¡†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'] }
                ]
          const vnode = createVNode(
            ElDialog,
            {
              title: "撤销组盘",
              width: "400px",
              modelValue: true,
              appendToBody: true,
              onOpened: () => {
                // å¯¹è¯æ¡†æ‰“开后自动聚焦输入框
                setTimeout(() => {
                  const inputRef = vnode.component.refs.palletCodeInput;
                  inputRef?.focus();
                }, 100);
              },
              ref: 'cancelPalletForm'
            }, [
              // æ‰˜ç›˜å·è¾“入项
              h(ElFormItem, { label: '托盘条码', prop: 'palletCode', required: true }, [
                h(ElInput, {
                  type: 'text',
                  modelValue: formData.palletCode,
                  'onUpdate:modelValue': (val) => {
                    formData.palletCode = val;
              "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",
                  },
                  ref: 'palletCodeInput',
                  placeholder: '扫码输入或手动输入托盘号',
                  maxLength: 50,
                  // ç›‘听回车事件(扫码枪默认会发送回车)
                  onKeydown: (e) => {
                    if (e.key === 'Enter') {
                      e.preventDefault();
                      submitForm();
                    }
                  }
                })
              ]),
              h(ElFormItem, { label: ' å†…箱标签', prop: 'barcode' }, [
                h(ElInput, {
                  type: 'text',
                  modelValue: formData.barcode,
                  'onUpdate:modelValue': (val) => {
                    formData.barcode = val;
                  },
                  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上下文
                }, '确认撤销')
              ])
            ])
          });
                  [
                    // æ‰˜ç›˜å·è¾“入项
                    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(ElFormItem, { label: " å†…箱标签", prop: "barcode" }, [
                      h(ElInput, {
                        type: "text",
                        modelValue: formData.barcode,
                        "onUpdate:modelValue": (val) => {
                          formData.barcode = val;
                        },
                        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();
      // {
      //   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;
          }
      //     // æ ¡éªŒ1:是否选中行(至少选择一条)
      //     if (selectedRows.length === 0) {
      //       console.log('校验不通过:未选中任何单据');
      //       ElMessage.warning('请选择至少一条单据');
      //       return;
      //     }
          // æ”¶é›†æ‰€æœ‰é€‰ä¸­å•据的编号(过滤无单据号的异常行)
          const inboundOrderNos = selectedRows
            .filter(row => row.inboundOrderNo)
            .map(row => row.inboundOrderNo);
      //     // æ”¶é›†æ‰€æœ‰é€‰ä¸­å•据的编号(过滤无单据号的异常行)
      //     const inboundOrderNos = selectedRows
      //       .filter(row => row.inboundOrderNo)
      //       .map(row => row.inboundOrderNo);
          // æ ¡éªŒ2:是否有有效单据号
          if (inboundOrderNos.length === 0) {
            console.log('校验不通过:选中单据无有效编号');
            ElMessage.warning('选中的单据中无有效编号,请重新选择');
            return;
          }
      //     // æ ¡éªŒ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
            });
      //     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(`分批入库成功!`);
              this.refresh(); // å…¥åº“成功后刷新列表(复用原有逻辑)
            } else {
              console.log('分批入库失败,后端提示:', message);
              ElMessage.error(message || data?.message || '分批入库失败');
            }
          } catch (error) {
            console.error('分批入库请求异常:', error);
            ElMessage.error('网络异常或接口错误,请稍后重试');
          }
        }
      },
    ], box: [], detail: []
      //       const { status, message, data } = response;
      //       if (status) {
      //         console.log('分批入库成功,后端返回:', data);
      //         ElMessage.success(`分批入库成功!`);
      //         this.refresh(); // å…¥åº“成功后刷新列表(复用原有逻辑)
      //       } else {
      //         console.log('分批入库失败,后端提示:', message);
      //         ElMessage.error(message || data?.message || '分批入库失败');
      //       }
      //     } catch (error) {
      //       console.error('分批入库请求异常:', error);
      //       ElMessage.error('网络异常或接口错误,请稍后重试');
      //     }
      //   }
      // },
    ],
    box: [],
    detail: [],
  },
  methods: {
    //下面这些方法可以保留也可以删除
    onInit() {
      var EmptyTrayInboundBtn = this.buttons.find(x => x.value == "EmptyTrayInbound");
        if (EmptyTrayInboundBtn != null) {
          EmptyTrayInboundBtn.onClick = () => {
               this.$refs.gridHeader.open();
            }
        }
        var GroupPalletBtn = this.buttons.find(x => x.value == "GroupPallet");
        if (GroupPalletBtn != null) {
          GroupPalletBtn.onClick = () => {
              // console.log(this.$refs)
               this.$refs.gridBody.open();
            }
        }
      var EmptyTrayInboundBtn = this.buttons.find(
        (x) => x.value == "EmptyTrayInbound"
      );
      if (EmptyTrayInboundBtn != null) {
        EmptyTrayInboundBtn.onClick = () => {
          this.$refs.gridHeader.open();
        };
      }
      var BatchInOrderFeedbackToMesBtn = this.buttons.find(
        (x) => x.value == "BatchInOrderFeedbackToMes"
      );
      if (BatchInOrderFeedbackToMesBtn != null) {
        BatchInOrderFeedbackToMesBtn.onClick = () => {
          var rows = this.$refs.table.getSelected();
          // æ ¡éªŒæ˜¯å¦æœ‰é€‰ä¸­æ•°æ®
          if (!rows || rows.length === 0) {
            return this.$Message.error("请先选择需要处理的单据");
          }
          if (rows.length > 1) {
            return this.$Message.error("请选择一条数据");
          }
          this.http.post(`api/Inbound/BatchInOrderFeedbackToMes?OrderNo=${rows[0].inboundOrderNo}`,{},"数据处理中...")
            .then((x) => {
              if (x.status) {
                this.$Message.success(x.message);
                this.refresh();
              } else {
                return this.$Message.error(x.message);
              }
            })
            .catch((error) => {
              // å¢žåŠ å¼‚å¸¸æ•èŽ·ï¼Œå¤„ç†ç½‘ç»œé”™è¯¯ç­‰æƒ…å†µ
              //_this.$Message.error('请求失败:' + (error.message || '未知错误'));
            });
        };
      }
      this.columns.forEach(column => {
        if (column.field === 'orderStatistics') {
      // let BatchInOrderFeedbackToMesBtn = this.buttons.find((x) => x.value == "BatchInOrderFeedbackToMes");
      // if (BatchInOrderFeedbackToMesBtn != null) {
      //   BatchInOrderFeedbackToMesBtn.onClick = ()=> {
      //     let selectedRows = this.$refs.table.getSelected();
      //     // æ ¡éªŒæ˜¯å¦æœ‰é€‰ä¸­æ•°æ®
      //     if (!selectedRows || selectedRows.length === 0) {
      //       return this.$Message.warning("请先选择需要处理的单据");
      //     }
      //     if (selectedRows.length > 1) {
      //       return this.$Message.warning("请选择一条数据");
      //     }
      //     this.http.post(`api/Inbound/BatchInOrderFeedbackToMes?orderNo=${selectedRows[0].orderNo}`,{},"数据处理中...")
      //       .then((x) => {
      //         if (x.status) {
      //           this.$Message.success("分批出库回调完成");
      //           this.refresh();
      //         } else {
      //           return this.$Message.error("分批出库回调失败");
      //         }
      //       })
      //       .catch((error) => {
      //         // å¢žåŠ å¼‚å¸¸æ•èŽ·ï¼Œå¤„ç†ç½‘ç»œé”™è¯¯ç­‰æƒ…å†µ
      //         //_this.$Message.error('请求失败:' + (error.message || '未知错误'));
      //       });
      //   };
      // }
      var GroupPalletBtn = this.buttons.find((x) => x.value == "GroupPallet");
      if (GroupPalletBtn != null) {
        GroupPalletBtn.onClick = () => {
          // console.log(this.$refs)
          this.$refs.gridBody.open();
        };
      }
      this.columns.forEach((column) => {
        if (column.field === "orderStatistics") {
          column.formatter = (row) => {
            // æ ¡éªŒdetails是否存在且有数据
            if (row.details && row.details.length > 0) {
              //按materielCode分组统计orderQuantity总和
              const materielSumMap = row.details.reduce((acc, item) => {
                const materielCode = item.materielCode || '未知物料';
                const materielCode = item.materielCode || "未知物料";
                const quantity = Number(item.orderQuantity) || 0;
                acc[materielCode] = (acc[materielCode] || 0) + quantity;
                return acc;
              }, {});
              //每个物料项生成独立div,跨行显示
              const displayItems = Object.entries(materielSumMap).map(([code, total]) => {
                return `<div style="line-height: 1.5; white-space: normal;">${code}:${total}个</div>`;
              });
              const displayContent = displayItems.join('');
              const displayItems = Object.entries(materielSumMap).map(
                ([code, total]) => {
                  return `<div style="line-height: 1.5; white-space: normal;">${code}:${total}个</div>`;
                }
              );
              const displayContent = displayItems.join("");
              return `<div style="color: #F56C6C; white-space: normal; word-break: break-all;">${displayContent}</div>`;
            } else {
              return '<span style="color: #F56C6C">无入库明细</span>';
@@ -261,7 +373,6 @@
      });
    },
    onInited() {
      //框架初始化配置后
      //如果要配置明细表,在此方法操作
      //this.detailOptions.columns.forEach(column=>{ });
@@ -270,12 +381,13 @@
      //界面查询前,可以给param.wheres添加查询参数
      //返回false,则不会执行查询
      // this.searchFormFields.orderType=[0]
      let wheres = [{
        'name': 'orderType',
        'value': '0',
        'displayType': 'text'
      }];
      let wheres = [
        {
          name: "orderType",
          value: "0",
          displayType: "text",
        },
      ];
      param.wheres.push(...wheres);
      return true;
@@ -302,7 +414,7 @@
      //(3)this.editFormFields.字段='xxx';
      //如果需要给下拉框设置默认值,请遍历this.editFormOptions找到字段配置对应data属性的key值
      //看不懂就把输出看:console.log(this.editFormOptions)
    }
  }
    },
  },
};
export default extension;
export default extension;
ÏîÄ¿´úÂë/WIDESEA_WMSClient/src/views/inbound/inboundOrder.vue
@@ -313,6 +313,14 @@
          bind: { key: "orderDetailStatusEnum", data: [] },
        },
        {
          field: "returnToMESStatus",
          title: "回传状态",
          type: "string",
          width: 90,
          align: "left",
          bind: { key: "returnStatus", data: [{ key: 0, value: "未回传" }, { key: 1, value: "已回传成功" }, { key: 2, value: "回传失败" }] }
        },
        {
          field: "creater",
          title: "创建人",
          type: "string",
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.1231.31060/CodeChunks.db
Binary files differ
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.1231.31060/CodeChunks.db-shm
Binary files differ
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.1231.31060/CodeChunks.db-wal
Binary files differ
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.1231.31060/SemanticSymbols.db
Binary files differ
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.1231.31060/SemanticSymbols.db-shm
Binary files differ
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.1231.31060/SemanticSymbols.db-wal
Binary files differ
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_DTO/Allocate/AllocateDto.cs
@@ -116,6 +116,7 @@
        public List<BarcodeInfo>? Barcodes { get; set; }
    }
    /// <summary>
    /// æ¡ç ä¿¡æ¯
    /// </summary>
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_IInboundService/IInboundService.cs
@@ -29,5 +29,13 @@
        /// <returns></returns>
        Task<WebResponseContent> AllcatedGroupPallet(GroupPalletDto palletDto);
        /// <summary>
        /// å…¥åº“分批回传
        /// </summary>
        /// <param name="OrderNo"></param>
        /// <returns></returns>
        WebResponseContent BatchInOrderFeedbackToMes(string OrderNo);
    }
}
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_InboundService/InboundService.cs
@@ -1,5 +1,7 @@
using LogLibrary.Log;
using MailKit;
using MailKit.Search;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -11,8 +13,11 @@
using WIDESEA_Core;
using WIDESEA_Core.BaseRepository;
using WIDESEA_Core.Helper;
using WIDESEA_Core.Util;
using WIDESEA_Core.Utilities;
using WIDESEA_DTO.Allocate;
using WIDESEA_DTO.Inbound;
using WIDESEA_DTO.ReturnMES;
using WIDESEA_IInboundService;
using WIDESEA_IStockService;
using WIDESEA_Model.Models;
@@ -35,8 +40,8 @@
        private readonly IRepository<Dt_Task> _taskRepository;
        private IStockService _stockService;
        private readonly IRepository<Dt_AllocateMaterialInfo> _allocateMaterialInfo;
        public InboundService(IUnitOfWorkManage unitOfWorkManage, IInboundOrderDetailService inboundOrderDetailService, IInboundOrderService inbounOrderService, IRepository<Dt_InboundOrder> inboundOrderRepository, IRepository<Dt_WarehouseArea> warehouseAreaRepository, IRepository<Dt_LocationType> locationTypeRepository, IRepository<Dt_StockInfo> stockInfoRepository, IRepository<Dt_InboundOrderDetail> inboundOrderDetailRepository, IStockService stockService, IRepository<Dt_Task> taskRepository,IRepository<Dt_AllocateMaterialInfo> allocateMaterialInfo)
        private readonly HttpClientHelper _httpClientHelper;
        public InboundService(IUnitOfWorkManage unitOfWorkManage, IInboundOrderDetailService inboundOrderDetailService, IInboundOrderService inbounOrderService, IRepository<Dt_InboundOrder> inboundOrderRepository, IRepository<Dt_WarehouseArea> warehouseAreaRepository, IRepository<Dt_LocationType> locationTypeRepository, IRepository<Dt_StockInfo> stockInfoRepository, IRepository<Dt_InboundOrderDetail> inboundOrderDetailRepository, IStockService stockService, IRepository<Dt_Task> taskRepository,IRepository<Dt_AllocateMaterialInfo> allocateMaterialInfo, HttpClientHelper httpClientHelper)
        {
            _unitOfWorkManage = unitOfWorkManage;
            InboundOrderDetailService = inboundOrderDetailService;
@@ -49,6 +54,7 @@
            _stockService = stockService;
            _taskRepository = taskRepository;
            _allocateMaterialInfo = allocateMaterialInfo;
            _httpClientHelper = httpClientHelper;
        }
        public async Task<WebResponseContent> GroupPallet(GroupPalletDto palletDto)
@@ -319,5 +325,211 @@
                return WebResponseContent.Instance.Error(ex.Message);
            }
        }
        public WebResponseContent BatchInOrderFeedbackToMes(string OrderNo)
        {
            WebResponseContent content = new WebResponseContent();
            try
            {
                var inboundOrder = _inboundOrderRepository.Db.Queryable<Dt_InboundOrder>()
                                    .Where(x => x.InboundOrderNo == OrderNo)
                                    .First();
                var inboundOrderDetail = _inboundOrderRepository.Db.Queryable<Dt_InboundOrderDetail>()
                                        .Where(x => x.OrderId == inboundOrder.Id && x.OrderDetailStatus==(int)OrderDetailStatusEnum.Over && x.ReturnToMESStatus == 0)
                                        .ToList();
                var stocks = _stockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.StockStatus == 6)
                                            .Where(it => SqlFunc.Subqueryable<Dt_StockInfoDetail>().Where(s => s.StockId == it.Id && s.OrderNo == OrderNo).Any())
                                            .ToList();
                var stockIds = stocks.Select(s => s.Id).ToList();
                var allDetailsData = _stockInfoRepository.Db.Queryable<Dt_StockInfoDetail>()
                                    .Where(x => stockIds.Contains(x.StockId))
                                    .ToList();
                var matchedData = inboundOrderDetail
                                .Join(allDetailsData,
                                    inbound => inbound.Barcode,
                                    stockdetail => stockdetail.Barcode,
                                    (inbound, stockdetail) => inbound.Barcode)
                                .ToList();
                var inbounddetailID = inboundOrderDetail
                                .Join(allDetailsData,
                                    inbound => inbound.Barcode,
                                    stockdetail => stockdetail.Barcode,
                                    (inbound, stockdetail) => inbound.Id)
                                .ToList();
                var detail = allDetailsData.Where(x => matchedData.Contains(x.Barcode)).ToList();
                if (inboundOrder.OrderType == (int)InOrderTypeEnum.AllocatInbound)//调拨入库
                {
                    var allocate = _inboundOrderRepository.Db.Queryable<Dt_AllocateOrder>().Where(x => x.OrderNo == inboundOrder.InboundOrderNo).First();
                    var allocatefeedmodel = new AllocateDto
                    {
                        ReqCode = Guid.NewGuid().ToString(),
                        ReqTime = DateTime.Now.ToString(),
                        BusinessType = "3",
                        FactoryArea = inboundOrder.FactoryArea,
                        OperationType = 1,
                        Operator = inboundOrder.Operator,
                        OrderNo = inboundOrder.UpperOrderNo,
                        fromWarehouse = allocate?.FromWarehouse ?? "",
                        toWarehouse = allocate?.ToWarehouse ?? "",
                        Details = GetAllocateDtoDetails(detail)
                    };
                    if (allocatefeedmodel.Details.Count <= 0)
                    {
                        throw new Exception("未找到需要回传的数据");
                    }
                    var response = responseModel(inboundOrder, 3,null, allocatefeedmodel);
                    if (response != null && response.IsSuccess)
                    {
                        _inboundOrderRepository.Db.Updateable<Dt_InboundOrderDetail>().SetColumns(it => new Dt_InboundOrderDetail { ReturnToMESStatus = 1 })
                        .Where(it => it.OrderId == inboundOrder.Id).ExecuteCommand();
                    }
                }
                else
                {
                    var feedmodel = new FeedbackInboundRequestModel
                    {
                        reqCode = Guid.NewGuid().ToString(),
                        reqTime = DateTime.Now.ToString(),
                        business_type = inboundOrder.BusinessType,
                        factoryArea = inboundOrder.FactoryArea,
                        operationType = 1,
                        Operator = inboundOrder.Operator,
                        orderNo = inboundOrder.UpperOrderNo,
                        status = inboundOrder.OrderStatus,
                        details = FeedbackInboundDetailsModelDto(detail)
                    };
                    if (feedmodel.details.Count<=0)
                    {
                        throw new Exception("未找到需要回传的数据");
                    }
                    var response = responseModel(inboundOrder, 3, feedmodel);
                    if (response != null && response.IsSuccess)
                    {
                        _inboundOrderRepository.Db.Updateable<Dt_InboundOrderDetail>().SetColumns(it => new Dt_InboundOrderDetail { ReturnToMESStatus = 1 })
                        .Where(it => inbounddetailID.Contains(it.Id)).ExecuteCommand();
                    }
                    else
                    {
                        _inboundOrderRepository.Db.Updateable<Dt_InboundOrderDetail>().SetColumns(it => new Dt_InboundOrderDetail { ReturnToMESStatus = 2 })
                         .Where(it => inbounddetailID.Contains(it.Id)).ExecuteCommand();
                        return content.Error("回传MES失败");
                    }
                }
                return content.OK("回传MES成功");
            }
            catch (Exception ex)
            {
                return content.Error(ex.Message);
            }
        }
        public List<AllocateDtoDetail> GetAllocateDtoDetails(List<Dt_StockInfoDetail> stockInfoDetails)
        {
            var groupedData = stockInfoDetails.GroupBy(item => new { item.MaterielCode, item.InboundOrderRowNo, item.BarcodeUnit, item.WarehouseCode })
               .Select(group => new AllocateDtoDetail
               {
                   MaterialCode = group.Key.MaterielCode,
                   LineNo = group.Key.InboundOrderRowNo,
                   WarehouseCode = group.Key.WarehouseCode,
                   Qty = group.Sum(x => x.BarcodeQty),
                   Unit = group.Key.BarcodeUnit,
                   Barcodes = group.Select(row => new BarcodeInfo
                   {
                       Barcode = row.Barcode,
                       Qty = row.BarcodeQty,
                       BatchNo = row.BatchNo,
                       SupplyCode = row.SupplyCode,
                       Unit = row.BarcodeUnit
                   }).ToList()
               }).ToList();
            return groupedData;
        }
        public List<FeedbackInboundDetailsModel> FeedbackInboundDetailsModelDto(List<Dt_StockInfoDetail> stockInfoDetails)
        {
            var groupedData = stockInfoDetails.GroupBy(item => new { item.MaterielCode, item.InboundOrderRowNo, item.BarcodeUnit, item.WarehouseCode })
               .Select(group => new FeedbackInboundDetailsModel
               {
                   materialCode = group.Key.MaterielCode,
                   lineNo = group.Key.InboundOrderRowNo,
                   warehouseCode = group.Key.WarehouseCode,
                   qty = group.Sum(x => x.BarcodeQty),
                   unit = group.Key.BarcodeUnit,
                   barcodes = group.Select(row => new FeedbackBarcodesModel
                   {
                       barcode = row.Barcode,
                       qty = row.BarcodeQty
                   }).ToList()
               }).ToList();
            return groupedData;
        }
        public HttpResponseResult<MesResponseDTO> responseModel(Dt_InboundOrder order, int InterfaceType, FeedbackInboundRequestModel model = null, AllocateDto allocateDto = null)
        {
            HttpResponseResult<MesResponseDTO> httpResponseResult = new HttpResponseResult<MesResponseDTO>();
            string reqCode = Guid.NewGuid().ToString();
            string reqTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            string requestData = string.Empty;
            string apiUrl = string.Empty;
            if (model != null)
            {
                apiUrl = AppSettings.GetValue("AldMaterialWarehousing");
                httpResponseResult = _httpClientHelper.Post<MesResponseDTO>(apiUrl, model.Serialize());
                requestData = model.Serialize();
            }
            else
            {
                apiUrl = AppSettings.GetValue("AldAllocationOperation");
                httpResponseResult = _httpClientHelper.Post<MesResponseDTO>(apiUrl, allocateDto.Serialize());
                requestData = allocateDto.Serialize();
            }
            httpResponseResult.ApiUrl = apiUrl;
            bool isSuccess = httpResponseResult.IsSuccess && httpResponseResult.Data.Code == "200";
            string message = "成功";
            if (!isSuccess)
            {
                if (!httpResponseResult.IsSuccess)
                {
                    message = $"MES接口返回错误,HTTP代码:{httpResponseResult.StatusCode},信息:{httpResponseResult.ErrorMessage}";
                }
                else if (httpResponseResult?.Data?.Code != "200")
                {
                    message = $"调用MES接口失败,代码:{httpResponseResult?.Data?.Code},信息:{httpResponseResult?.Data?.Message}";
                }
            }
            Dt_MesReturnRecord mesReturnRecord = new Dt_MesReturnRecord()
            {
                ApiUrl = httpResponseResult.ApiUrl,
                InterfaceType = InterfaceType,
                OrderId = order.Id,
                OrderNo = order.InboundOrderNo,
                RequestCode = reqCode,
                RequestData = requestData,
                FailureReason = message,
                LastReturnTime = DateTime.Now,
                HttpStatusCode = httpResponseResult.StatusCode.ObjToInt(),
                ResponseData = httpResponseResult.Content,
                ReturnType = 0,
                ReturnCount = 1,
                ReturnStatus = httpResponseResult.IsSuccess ? 1 : 2,
                SuccessTime = httpResponseResult.IsSuccess ? DateTime.Now : null
            };
            _unitOfWorkManage.Db.Insertable(mesReturnRecord).ExecuteCommand();
            return httpResponseResult;
        }
    }
}
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_Model/Models/Inbound/Dt_InboundOrderDetail.cs
@@ -130,7 +130,7 @@
        public string BarcodeUnit { get; set; } = null!;
        /// <summary>
        /// å›žä¼ MES
        /// å›žä¼ MES 0未回传 1已回传 2回传失败
        /// </summary>
        [SugarColumn(IsNullable = true, ColumnDescription = "回传MES")]
        public int ReturnToMESStatus { get; set; } = 0;
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Inbound/InboundController.cs
@@ -39,5 +39,16 @@
        {
            return await Service.AllcatedGroupPallet(palletDto);
        }
        /// <summary>
        /// å…¥åº“分批回传MES
        /// </summary>
        /// <param name="palletDto"></param>
        /// <returns></returns>
        [HttpPost, Route("BatchInOrderFeedbackToMes"), AllowAnonymous]
        public WebResponseContent BatchInOrderFeedbackToMes(string OrderNo)
        {
            return Service.BatchInOrderFeedbackToMes(OrderNo);
        }
    }
}
ÏîÄ¿×ÊÁÏ/½Ó¿ÚÎĵµ/~$S½Ó¿Ú¶Ô½ÓÎĵµ_V1.04.doc
Binary files differ
ÏîÄ¿×ÊÁÏ/½Ó¿ÚÎĵµ/~$es½Ó¿ÚÎĵµ.docx
Binary files differ