zjh
8 天以前 cf5e996699836cc380b1cb469fea341475eb2b81
StandardPda/MESApplication/Controllers/QC/LljController.cs
@@ -1,10 +1,9 @@
using Masuit.Tools;
using MES.Service.Dto.service;
using MES.Service.Dto.service;
using MES.Service.Modes;
using MES.Service.service.QC;
using MES.Service.util;
using Microsoft.AspNetCore.Mvc;
using NetTaste;
using Microsoft.EntityFrameworkCore.Metadata.Internal;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.Data;
@@ -50,7 +49,7 @@
        {
            dynamic resultInfos = new ExpandoObject();
            string[] msg = new LljService().SetItems(itemNo, quantity, releaseNo);
            var msg = new LljService().SetItems(itemNo, quantity, releaseNo);
            return new ResponseResult
            {
@@ -98,10 +97,10 @@
            var releaseNo = data["releaseNo"].ToString();
            var NewStaffUserID = data["NewStaffUserID"].ToString();
            string[] msg = new LljService().SaveCheckBy(NewStaffUserID, userID, releaseNo);
            var msg =
                new LljService().SaveCheckBy(NewStaffUserID, userID, releaseNo);
            return new ResponseResult
            {
                status = int.Parse(msg[0]),
@@ -143,19 +142,18 @@
    }
    /// <summary>
    /// 获取一致性核对项目
    ///     获取一致性核对项目
    /// </summary>
    /// <param name="data"></param>
    /// <returns></returns>
    [HttpPost("getYzxItem")]
    public ResponseResult getYzxItem([FromBody] JObject data)
    {
        var id = data["id"]?.ToString();
        try
        {
            var tbBillList =new LljService().getYzxBDlist(id);
            var tbBillList = new LljService().getYzxBDlist(id);
            return new ResponseResult
            {
                status = 0,
@@ -170,16 +168,15 @@
    }
    /// <summary>
    /// 获取检验单所有不良描述
    ///     获取检验单所有不良描述
    /// </summary>
    /// <param name="data"></param>
    /// <returns></returns>
    [HttpPost("getJYBlmsItem")]
    public ResponseResult getJYBlmsItem([FromBody] JObject data)
    {
        var id = data["id"]?.ToString();
        try
        {
            var tbBillList = new LljService().getBlmsItem(id);
@@ -199,25 +196,33 @@
    /// <summary>
    /// 保存一致性核对项目
    ///     保存一致性核对项目
    /// </summary>
    /// <param name="data"></param>
    /// <returns></returns>
    [HttpPost("saveYzxItem")]
    public ResponseResult saveYzxItem([FromBody] JObject data)
    {
        var id = data["id"]?.ToString();
        var dataDt = data["data"]?.ToString();
        DataTable dt = JsonConvert.DeserializeObject<DataTable>(dataDt);
        var dt = JsonConvert.DeserializeObject<DataTable>(dataDt);
        try
        {
            if (!dt.Columns.Contains("id"))
            {
                return new ResponseResult
                {
                    status = 1,
                    message = "请先选择数据再保存!",
                    data = "请先选择数据再保存!"
                };
            }
            new LljService().saveYzxBDlist(id, dt);
            string[] msg=new LljService().YzxImgVerify(id);
            var msg = new LljService().YzxImgVerify(id);
            return new ResponseResult
            {
                status = int.Parse( msg[0]),
                status = int.Parse(msg[0]),
                message = msg[1],
                data = ""
            };
@@ -229,14 +234,13 @@
    }
    /// <summary>
    /// 获取所有检验员信息
    ///     获取所有检验员信息
    /// </summary>
    /// <param name="data"></param>
    /// <returns></returns>
    [HttpPost("getAllInspectors")]
    public ResponseResult getAllInspectors([FromBody] JObject data)
    {
        try
        {
            var tbBillList = new LljService().getAllInspectors();
@@ -281,7 +285,7 @@
    /// <summary>
    /// 通过条码获取送检单信息
    ///     通过条码获取送检单信息
    /// </summary>
    /// <param name="data"></param>
    /// <returns></returns>
@@ -296,12 +300,40 @@
            var tbBillList =
                new LljService().getFromInfo(id);
            resultInfos.tbBillList = tbBillList;
            return new ResponseResult
            if (resultInfos.tbBillList.Rows.Count>0)
            {
                status = 0,
                message = "OK",
                data = resultInfos
            };
                return new ResponseResult
                {
                    status = 0,
                    message = "OK",
                    data = resultInfos
                };
            }
            else
            {
                var mj =
                new LljService().getFromMJCount(id);
                if (mj>0)
                {
                    return new ResponseResult
                    {
                        status = 1,
                        message = "该物料为免检物料,无需检验!",
                        data = resultInfos
                    };
                }
                else
                {
                    return new ResponseResult
                    {
                        status = 1,
                        message = "找不到检验单据,请确认货物是否签收!",
                        data = resultInfos
                    };
                }
            }
        }
        catch (Exception ex)
        {
@@ -311,20 +343,19 @@
    /// <summary>
    /// 获取不良描述信息
    ///     获取不良描述信息
    /// </summary>
    /// <param name="data"></param>
    /// <returns></returns>
    [HttpPost("getBlmsItem")]
    public ResponseResult getBlmsItem([FromBody] JObject data)
    {
        try
        {
            var tbBillList = new LljService().getBlmsItem();
            string[] arrRate = tbBillList.AsEnumerable().Select(d => d.Field<string>("DEFECT_NAME")).ToArray();
            string[] arrRate = tbBillList.AsEnumerable()
                .Select(d => d.Field<string>("DEFECT_NAME")).ToArray();
            return new ResponseResult
            {
@@ -464,7 +495,7 @@
        {
            dynamic resultInfos = new ExpandoObject();
            var msg = new LljService().IqcQaSubmit(rkjDto);
            return new ResponseResult
            {
                status = int.Parse(msg[0]),
@@ -477,6 +508,7 @@
            return ResponseResult.ResponseError(ex);
        }
    }
    //IqcQaSubmit
    [HttpPost("getImgBDlist")]
    public ResponseResult getImgBDlist([FromBody] JObject data)
@@ -484,7 +516,7 @@
        try
        {
            var id = data["id"]?.ToString();
            var db = new LljService().getImgBDlist(id);
            return new ResponseResult
@@ -501,12 +533,13 @@
    }
    /// <summary>
    /// 获取U9图纸数据
    ///     获取U9图纸数据
    /// </summary>
    /// <param name="data"></param>
    /// <returns></returns>
    [HttpPost("GetFileUrlByU9List")]
    public async Task<ResponseResult> GetFileUrlByU9List([FromBody] JObject data)
    public async Task<ResponseResult> GetFileUrlByU9List(
        [FromBody] JObject data)
    {
        try
        {
@@ -516,32 +549,28 @@
            var lljService = new LljService();
            var tbBillList = await lljService.GetFileUrlByU9List(type, itemID);
            if (tbBillList != null)
            {
                return new ResponseResult
                {
                    status = 0,
                    message = "OK",
                    data = tbBillList
                };
            }
            else
            {
                return new ResponseResult
                {
                    status = 0,
                    message = "OK",
                    data = ""
                };
            }
            return new ResponseResult
            {
                status = 0,
                message = "OK",
                data = ""
            };
        }
        catch (Exception ex)
        {
            return ResponseResult.ResponseError(ex);
        }
    }
    /// <summary>
    /// 实验室送检数据保存
    ///     实验室送检数据保存
    /// </summary>
    /// <param name="sysSubmit">实验室送检数据</param>
    /// <returns></returns>
@@ -550,8 +579,7 @@
    {
        try
        {
            string[] msg = new LljService().SaveSysSubmit(sysSubmit);
            var msg = new LljService().SaveSysSubmit(sysSubmit);
            return new ResponseResult
            {
@@ -565,4 +593,78 @@
            return ResponseResult.ResponseError(ex);
        }
    }
    /// <summary>
    ///     送货单签收并生成到货单
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    [HttpPost("SignDelivery")]
    public async Task<ResponseResult> SignDelivery(string id)
    {
        try
        {
            //string[] msg = new LljService().SaveSysSubmit(sysSubmit);
            var msg = await new LljService().SignDelivery(id);
            return new ResponseResult
            {
                status = int.Parse(msg[0]),
                message = msg[1],
                data = msg[1]
            };
        }
        catch (Exception ex)
        {
            return ResponseResult.ResponseError(ex);
        }
    }
    /// <summary>
    ///     送货单签收并生成到货单
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    [HttpPost("SignDelivery2")]
    public async Task<ResponseResult> SignDelivery2(string id,string c_user)
    {
        try
        {
            //string[] msg = new LljService().SaveSysSubmit(sysSubmit);
            var msg = await new LljService().SignDelivery2(id, c_user);
            return new ResponseResult
            {
                status = int.Parse(msg[0]),
                message = msg[1],
                data = msg[1]
            };
        }
        catch (Exception ex)
        {
            return ResponseResult.ResponseError(ex);
        }
    }
    /// <summary>
    ///     获取携客云测试环境签名
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    [HttpGet("getTestXKYSign")]
    public async Task<ResponseResult> getTestXKYSign()
    {
        try
        {
            //string[] msg = new LljService().SaveSysSubmit(sysSubmit);
            var msg = await new LljService().getTestXKYSign();
            return new ResponseResult
            {
                status = int.Parse(msg[0]),
                message = "OK",
                data = msg[1]
            };
        }
        catch (Exception ex)
        {
            return ResponseResult.ResponseError(ex);
        }
    }
}