import { BASE_PROVIDERS, CUSTOMER_PROVIDERS, COMPANY_PROVIDERS } from "./base";

export default {
  key: "ljProviderOutware",
  options: [
    {
      groupName: "单据信息",
      printElements: [
        {
          tid: "outwarecode",
          title: "送货单号",
          type: "text",
          options: {
            field: "outware.outwarecode",
            testData: "FXFH000000000"
          }
        },
        {
          tid: "outwaredate",
          title: "送货日期",
          type: "text",
          data: "2023年1月1日",
          options: {
            field: "outware.outwaredate",
            testData: "2023-01-01 10:00:00",
            formatter: function (title: any, value: any, options: any, templateData: any, target: any) {
              let time = new Date(value);
              let year = time.getFullYear() + "年";
              let month = time.getMonth() + 1 + "月";
              let date = time.getDate() + "日";
              return [year, month, date].join("");
            }
          }
        }
      ]
    },
    {
      groupName: "明细信息",
      printElements: [
        {
          tid: "outwareTable",
          title: "明细(表格)",
          type: "table",
          options: {
            field: "tableMx",
            fields: [
              {
                field: "printid",
                text: "序"
              },
              {
                field: "mtrlcuscode",
                text: "销售订单相关号"
              },
              {
                field: "mtrlcode",
                text: "物料编码"
              },
              {
                field: "mtrlname",
                text: "物料名称"
              },
              {
                field: "mtrlmode",
                text: "物料规格"
              },
              {
                field: "taskqty",
                text: "订单数量"
              },
              {
                field: "l1unit",
                text: "供应商单位"
              },
              {
                field: "qty",
                text: "发货数"
              },
              {
                field: "hasqty",
                text: "实收数量"
              },
              {
                field: "unit",
                text: "单位"
              },
              {
                field: "tid",
                text: "云订单号"
              },
              {
                field: "taskcode",
                text: "ERP订单号"
              },
              {
                field: "mxdscrp",
                text: "明细备注"
              },
              {
                field: "requiredate",
                text: "物料要求时间"
              },
              {
                field: "outwarecode",
                text: "相关发货单号"
              },
              {
                field: "packqty",
                text: "单箱数量"
              },
              {
                field: "plancode",
                text: "生产批号"
              },
              {
                field: "productdate",
                text: "生产日期"
              },
              {
                field: "earliestsenddate",
                text: "最早送货时间"
              },
              {
                field: "outwaredate",
                text: "发货时间"
              },
              {
                field: "username",
                text: "发货人"
              },
              {
                field: "inwarecode_erp",
                text: "ERP相关采购收货单"
              },
              {
                field: "autocode",
                text: "收货通知单号"
              },

              {
                field: "mxcode",
                text: "明细唯一码"
              },
              {
                field: "logstatus",
                text: "收货状态"
              },
              {
                field: "acceptusername",
                text: "收货(操作)人"
              },
              {
                field: "acceptdate",
                text: "收货(操作)时间"
              },
              {
                field: "tmpacceptemp",
                text: "暂收人"
              },
              {
                field: "checkqty",
                text: "检验数量"
              },
              {
                field: "goodqty",
                text: "进仓数"
              },
              {
                field: "badqty",
                text: "不合格数"
              },
              {
                field: "badinqty",
                text: "不合格进仓数"
              },
              {
                field: "tmpacceptqty",
                text: "暂收数"
              },
              {
                field: "notqty",
                text: "不足数"
              },
              {
                field: "goodinqty",
                text: "合格进仓数"
              },
              {
                field: "status",
                text: "配置"
              },
              {
                field: "woodcode",
                text: "配置1"
              },
              {
                field: "pcode",
                text: "配置2"
              },
              {
                field: "cus_receiveqty",
                text: "客户确认收货数"
              },
              {
                field: "cus_mtrldef_senddays",
                text: "最早送货提前天数"
              },
              {
                field: "sptflagstr",
                text: "待读状态"
              },
              {
                field: "barcode",
                text: "质检标志卡"
              },
              {
                field: "backqty",
                text: "退回数"
              },
              {
                field: "sptname",
                text: "供应商名称"
              },
              {
                field: "saletask_mxid",
                text: "销售订单明细序号"
              },
              {
                field: "order_mtrlname_str",
                text: "成品产品名称"
              },
              {
                field: "billtype",
                text: "单据类型"
              },
              {
                field: "relcodestr",
                text: "生产计划相关号"
              },
              {
                field: "taskcodestr",
                text: "相关销售订单号"
              },
              {
                field: "historybackcnt",
                text: "历史退货次数"
              },
              {
                field: "storagename",
                text: "收货仓库"
              }
            ],
            // 分组统计字段
            groupFieldsFormatter: "function(type,options,data){ return ['mtrlcode'] }"
          },
          editable: true,
          columnDisplayEditable: true, //列显示是否能编辑
          columnDisplayIndexEditable: true, //列顺序显示是否能编辑
          columnTitleEditable: true, //列标题是否能编辑
          columnResizable: true, //列宽是否能调整
          columnAlignEditable: true, //列对齐是否调整
          columns: [
            [
              {
                title: "序",
                align: "center",
                field: "printid",
                width: 50,
                tableTextType: "sequence",
                tableSummary: "count"
              },
              {
                field: "mtrlcuscode",
                title: "销售订单相关号",
                table: "fx_outware_log",
                align: "center"
              },
              {
                field: "mtrlcode",
                title: "物料编码",
                table: "fx_outware_log",
                align: "center"
              },
              {
                field: "mtrlname",
                title: "物料名称",
                table: "fx_outware_log",
                align: "center"
              },
              {
                field: "mtrlmode",
                title: "物料规格",
                table: "fx_outware_log",
                align: "center"
              },
              {
                field: "taskqty",
                title: "订单数量",
                table: "fx_outware_log",
                align: "center",
                checked: false
              },
              {
                field: "l1unit",
                title: "供应商单位",
                table: "fx_outware_log",
                align: "center",
                checked: false
              },
              {
                field: "qty",
                title: "发货数",
                table: "fx_outware_log_print",
                align: "center",
                tableSummary: "sum"
              },
              {
                field: "hasqty",
                title: "实收数量",
                table: "fx_outware_log_print",
                align: "center"
              },
              {
                field: "unit",
                title: "单位",
                table: "fx_outware_log",
                align: "center",
                checked: false
              },
              {
                field: "tid",
                title: "云订单号",
                table: "fx_outware_log",
                align: "center",
                checked: false
              },
              {
                field: "taskcode",
                title: "ERP订单号",
                table: "fx_outware_log",
                align: "center",
                checked: false
              },
              {
                field: "mxdscrp",
                title: "明细备注",
                table: "fx_outware_log",
                align: "center"
              },
              {
                field: "requiredate",
                title: "物料要求时间",
                table: "fx_outware_log",
                align: "center",
                checked: false
              },
              {
                field: "outwarecode",
                title: "相关发货单号",
                table: "fx_outware_log",
                align: "center",
                checked: false
              },
              {
                field: "packqty",
                title: "单箱数量",
                table: "fx_outware_log",
                align: "center",
                checked: false
              },
              {
                field: "plancode",
                title: "生产批号",
                table: "fx_outware_log",
                align: "center",
                checked: false
              },
              {
                field: "productdate",
                title: "生产日期",
                table: "fx_outware_log",
                align: "center",
                checked: false
              },
              {
                field: "earliestsenddate",
                title: "最早送货时间",
                table: "fx_outware_log",
                align: "center",
                checked: false
              },
              {
                field: "outwaredate",
                title: "发货时间",
                table: "fx_outware_log",
                align: "center",
                checked: false
              },
              {
                field: "username",
                title: "发货人",
                table: "fx_outware_log",
                align: "center",
                checked: false
              },
              {
                field: "inwarecode_erp",
                title: "ERP相关采购收货单",
                table: "fx_outware_log",
                align: "center",
                checked: false
              },
              {
                field: "autocode",
                title: "收货通知单号",
                table: "fx_outware_log",
                align: "center",
                checked: false
              },

              {
                field: "mxcode",
                title: "明细唯一码",
                table: "fx_outware_log",
                align: "center",
                checked: false
              },
              {
                field: "logstatus",
                title: "收货状态",
                table: "fx_outware_log",
                align: "center",
                checked: false
              },
              {
                field: "acceptusername",
                title: "收货(操作)人",
                table: "fx_outware_log",
                align: "center",
                checked: false
              },
              {
                field: "acceptdate",
                title: "收货(操作)时间",
                table: "fx_outware_log",
                align: "center",
                checked: false
              },
              {
                field: "tmpacceptemp",
                title: "暂收人",
                table: "fx_outware_log",
                align: "center",
                checked: false
              },
              {
                field: "checkqty",
                title: "检验数量",
                table: "fx_outware_log",
                align: "center",
                checked: false
              },
              {
                field: "goodqty",
                title: "进仓数",
                table: "fx_outware_log",
                align: "center",
                checked: false
              },
              {
                field: "badqty",
                title: "不合格数",
                table: "fx_outware_log",
                align: "center",
                checked: false
              },
              {
                field: "badinqty",
                title: "不合格进仓数",
                table: "fx_outware_log",
                align: "center",
                checked: false
              },
              {
                field: "tmpacceptqty",
                title: "暂收数",
                table: "fx_outware_log",
                align: "center",
                checked: false
              },
              {
                field: "notqty",
                title: "不足数",
                table: "fx_outware_log",
                align: "center",
                checked: false
              },
              {
                field: "goodinqty",
                title: "合格进仓数",
                table: "fx_outware_log",
                align: "center",
                checked: false
              },
              {
                field: "status",
                title: "配置",
                table: "fx_outware_log",
                align: "center",
                checked: false
              },
              {
                field: "woodcode",
                title: "配置1",
                table: "fx_outware_log",
                align: "center",
                checked: false
              },
              {
                field: "pcode",
                title: "配置2",
                table: "fx_outware_log",
                align: "center",
                checked: false
              },
              {
                field: "cus_receiveqty",
                title: "客户确认收货数",
                table: "fx_outware_log",
                align: "center",
                checked: false
              },
              {
                field: "cus_mtrldef_senddays",
                title: "最早送货提前天数",
                table: "fx_outware_log",
                align: "center",
                checked: false
              },
              {
                field: "sptflagstr",
                title: "待读状态",
                table: "fx_outware_log",
                align: "center",
                checked: false
              },
              {
                field: "barcode",
                title: "质检标志卡",
                table: "fx_outware_log",
                align: "center",
                checked: false
              },
              {
                field: "backqty",
                title: "退回数",
                table: "fx_outware_log",
                align: "center",
                checked: false
              },
              {
                field: "sptname",
                title: "供应商名称",
                table: "fx_outware_log",
                align: "center",
                checked: false
              },
              {
                field: "saletask_mxid",
                title: "销售订单明细序号",
                table: "fx_outware_log",
                align: "center",
                checked: false
              },
              {
                field: "order_mtrlname_str",
                title: "成品产品名称",
                table: "fx_outware_log",
                align: "center",
                checked: false
              },
              {
                field: "billtype",
                title: "单据类型",
                table: "fx_outware_log",
                align: "center",
                checked: false
              },
              {
                field: "relcodestr",
                title: "生产计划相关号",
                table: "fx_outware_log",
                align: "center",
                checked: false
              },
              {
                field: "taskcodestr",
                title: "相关销售订单号",
                table: "fx_outware_log",
                align: "center",
                checked: false
              },
              {
                field: "historybackcnt",
                title: "历史退货次数",
                table: "fx_outware_log",
                align: "center",
                checked: false
              },
              {
                field: "storagename",
                title: "收货仓库",
                table: "fx_saletaskmx",
                align: "center"
              }
            ]
          ]
          // footerFormatter: function (options: any, rows: any, data: any, currentPageGridRowsData: any) {
          //   if (data && data["totalCap"]) {
          //     return `<td style="padding:0 10px" colspan="100">${"应收金额大写: " + data["totalCap"]}</td>`;
          //   }
          //   return '<td style="padding:0 10px" colspan="100">应收金额大写: </td>';
          // }
        }
        // { tid: "_recordscustomText", title: "文本", customText: "自定义文本", custom: true, type: "text" },
      ]
    },
    {
      groupName: "二维码",
      printElements: [
        {
          tid: "qrcode",
          title: "送货单号",
          data: "FXFH000000000",
          type: "text",
          options: {
            field: "outware.outwarecode",
            testData: "FXFH000000000",
            height: 64,
            width: 64,
            textType: "qrcode"
          }
        }
      ]
    },
    {
      groupName: "签名",
      printElements: [
        {
          tid: "_signPurchase",
          title: "采购",
          type: "text",
          options: {
            height: 16,
            fontSize: 6.75,
            fontWeight: "700",
            textAlign: "left",
            textContentVerticalAlign: "middle",
            borderBottom: "solid"
          }
        },
        {
          tid: "_signQuality",
          title: "品管",
          type: "text",
          options: {
            height: 16,
            fontSize: 6.75,
            fontWeight: "700",
            textAlign: "left",
            textContentVerticalAlign: "middle",
            borderBottom: "solid"
          }
        },
        {
          tid: "_signStrage",
          title: "仓库",
          type: "text",
          options: {
            height: 16,
            fontSize: 6.75,
            fontWeight: "700",
            textAlign: "left",
            textContentVerticalAlign: "middle",
            borderBottom: "solid"
          }
        }
      ]
    },
    { ...CUSTOMER_PROVIDERS },
    { ...COMPANY_PROVIDERS },
    { ...BASE_PROVIDERS }
  ]
};
