1
yangle
19 小时以前 6d0bfe2160e06a4502dc3052c43fab9813341db3
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Http;
using WebAPI.Models;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.Diagnostics;
 
namespace WebAPI.Controllers.SCGL.日计划管理
{
    public class JIT_ICMOSortBillController : ApiController
    {
        private json objJsonResult = new json();
        public DataSet ds = new DataSet();
        public WebServer webserver = new WebServer();
        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
        Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
 
        #region 生产日计划 查询
        [Route("JIT_ICMOSortBill/JIT_ICMOSortBillList")]
        [HttpGet]
        public object JIT_ICMOSortBillList(string sWhere, string user)
        {
            try
            {
                //查看权限
                if (!DBUtility.ClsPub.Security_Log("Sc_WorkBillSortBill_Query", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无查看权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
 
 
                string Ret = "";
                if (oSystemParameter.ShowBill(ref Ret)) {
                    //判断客户为凯贝
                    if (oSystemParameter.omodel.WMS_CampanyName == "凯贝奈特") //系统参数                      
                    {
                        ds = oCN.RunProcReturn("select top 1000 * from h_v_Sc_ICMOSortBillList where 1=1"+ sWhere, "h_v_Sc_ICMOSortBillList");
                    }
                    else {
                        ds = oCN.RunProcReturn("select * from h_v_Sc_ICMOSortBillList where 1=1"+ sWhere , "h_v_Sc_ICMOSortBillList");
                    }
                }
 
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
 
        #region 生产日计划 齐料 缺料 撤销
        [Route("JIT_ICMOSortBill/JIT_ICMOSortBillCheck")]
        [HttpGet]
        public object JIT_ICMOSortBillCheck(string HSourceID, string HICMOInterID, DateTime HDate, int HStatus,string user)
        {
            try
            {
                oCN.RunProc("exec h_p_Sc_SetICMOStatus_ReadyMater " + HSourceID.ToString() + "," + HICMOInterID.ToString() + ",'" + HDate.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'," + HStatus.ToString() + ",'" + user + "'");
 
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "执行成功!";
                objJsonResult.data = null;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
 
        #region 生产日计划 车间执行确认  撤销车间执行确认
        [Route("JIT_ICMOSortBill/JIT_ICMOSortBillWorkShopTure")]
        [HttpGet]
        public object JIT_ICMOSortBillWorkShopTure(string HSourceID, string HICMOInterID, DateTime HDate, int HStatus, string user)
        {
            try
            {
                ds = oCN.RunProcReturn($"select * from Sc_ICMOBillStatus_Tmp_Extend where HSourceID = {HSourceID} and HSourceInterID = {HICMOInterID} and HDate = '{HDate.ToString("yyyy-MM-dd HH:mm:ss.fff")}' ", "Sc_ICMOBillStatus_Tmp_Extend");
 
                if (ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "仓库未确认,不能进行车间确认!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
 
                oCN.RunProc("exec h_p_Sc_SetICMOStatus_ReadyStart " + HSourceID.ToString() + "," + HICMOInterID.ToString() + ",'" + HDate.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'," + HStatus.ToString() + ",'" + user + "'");
 
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "执行成功!";
                objJsonResult.data = null;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
    }
}