333
schangxiang@126.com
2025-09-19 18966e02fb573c7e2bb0c6426ed792b38b910940
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
using Newtonsoft.Json;
using NPOI.SS.UserModel;
using NPOI.XSSF.UserModel;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIP_common;
using WIP_Models;
 
namespace WIP_Print
{
    /// <summary>
    /// 送检单打印
    /// </summary>
    public class InspectOrderPrint : PrintMgr
    {
        public InspectOrderPrint(PrintType printType)
            : base(printType)
        {
            
        }
        public override string GetJsonDataAsExcelCellModel(string printJson, string tempFileName)
        {
            var json_dataList = base.InitTempleteFileJsonData(tempFileName);
 
            InspectOrderPrintParam inspectOrderPrintParam = JsonConvert.DeserializeObject<InspectOrderPrintParam>(printJson);
            if (inspectOrderPrintParam == null)
            {
                throw new Exception("转换送检单对象为NULL");
            }
 
            //替换数据
            /*
            json_dataList = json_dataList.Replace("[taskNo]", WIPCommon.NullToEmpty(inspectOrderPrintParam.taskNo));
            json_dataList = json_dataList.Replace("[processCardNumber]", WIPCommon.NullToEmpty(inspectOrderPrintParam.processCardNumber));
            json_dataList = json_dataList.Replace("[heatingNumber]", WIPCommon.NullToEmpty(inspectOrderPrintParam.heatingNumber));
            json_dataList = json_dataList.Replace("[requestDate]", WIPCommon.NullToEmpty(inspectOrderPrintParam.requestDate));
            json_dataList = json_dataList.Replace("[partNumber]", WIPCommon.NullToEmpty(inspectOrderPrintParam.materialCode));//注意:这里显示的partNumber其实是物料编码 [EditBy shaocx,2019-02-18]
            json_dataList = json_dataList.Replace("[loadNumber]", inspectOrderPrintParam.loadNumber == null ? "" : inspectOrderPrintParam.loadNumber.ToString());
            json_dataList = json_dataList.Replace("[partName]", WIPCommon.NullToEmpty(inspectOrderPrintParam.partName));
            json_dataList = json_dataList.Replace("[typeOfSteels]", WIPCommon.NullToEmpty(inspectOrderPrintParam.typeOfSteels));
            json_dataList = json_dataList.Replace("[steelsHeatNo]", WIPCommon.NullToEmpty(inspectOrderPrintParam.steelsHeatNo));
            json_dataList = json_dataList.Replace("[steelsSize]", WIPCommon.NullToEmpty(inspectOrderPrintParam.steelsSize));
            json_dataList = json_dataList.Replace("[pilotNo]", WIPCommon.NullToEmpty(inspectOrderPrintParam.pilotNo));
            json_dataList = json_dataList.Replace("[inspectCount]", inspectOrderPrintParam.inspectCount.ToString());
 
            json_dataList = json_dataList.Replace(PrintStruct.QRCODE, WIPCommon.NullToEmpty(inspectOrderPrintParam.taskNo));//二维码
 
            //*/
 
            //最新版(使用反射)
            json_dataList = base.Replace<InspectOrderPrintParam>(inspectOrderPrintParam, json_dataList);
            json_dataList = json_dataList.Replace("[partNumber]", WIPCommon.NullToEmpty(inspectOrderPrintParam.materialCode));//注意:这里显示的partNumber其实是物料编码 [EditBy shaocx,2019-02-18]
            json_dataList = json_dataList.Replace(PrintStruct.QRCODE, WIPCommon.NullToEmpty(inspectOrderPrintParam.taskNo));//二维码
 
            return json_dataList;
        }
 
    }
}