chenhaozhe
2025-10-26 1948124877478db58b27841f9398aed97ef13053
WebAPI/Controllers/Éú²ú¹ÜÀí/±¨¹¤Ì¨¹¤Ðò/Sc_MESBeginStepWorkBillController.cs
@@ -2579,5 +2579,235 @@
            }
        }
        #endregion
        #region PDA产量汇报单
        //扫描生产订单获取信息
        [Route("Sc_MESBeginStepWorkBill/Get_Sc_ICMOList")]
        [HttpGet]
        public object Get_Sc_ICMOList(string HBarCode, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                if (HBarCode == null || HBarCode.Equals(""))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "条码信息为空!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    string sql = "select * from h_v_IF_ICMOBillList with(nolock) where å•据号= '" + HBarCode + "'";
                    ds = oCN.RunProcReturn(sql, "h_v_IF_ICMOBillList");
                }
                if (ds.Tables[0].Rows.Count > 0)
                {
                    //添加列名
                    foreach (DataColumn col in ds.Tables[0].Columns)
                    {
                        Type dataType = col.DataType;
                        string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                        columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
                    }
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "Sucess!";
                    objJsonResult.data = ds.Tables[0];
                    objJsonResult.list = columnNameList;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "条码:" + HBarCode + " ,不存在";
                    objJsonResult.data = ds.Tables[0];
                    objJsonResult.list = columnNameList;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        //扫描客户条码查出信息
        [Route("Sc_MESBeginStepWorkBill/Get_Gy_BarCodeBill_CusList")]
        [HttpGet]
        public object Get_Gy_BarCodeBill_CusList(string HBarCode, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                if (HBarCode == null || HBarCode.Equals(""))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "条码信息为空!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    string sql = "select * from Gy_BarCodeBill_Cus a with(nolock)  left join Gy_Material b with(nolock)  on a.hmaterid=b.hitemid where HBarCode= '" + HBarCode + "'";
                    ds = oCN.RunProcReturn(sql, "Gy_BarCodeBill_Cus");
                }
                if (ds.Tables[0].Rows.Count > 0)
                {
                    //添加列名
                    foreach (DataColumn col in ds.Tables[0].Columns)
                    {
                        Type dataType = col.DataType;
                        string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                        columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
                    }
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "Sucess!";
                    objJsonResult.data = ds.Tables[0];
                    objJsonResult.list = columnNameList;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "条码:" + HBarCode + " ,不存在";
                    objJsonResult.data = ds.Tables[0];
                    objJsonResult.list = columnNameList;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        //产量汇报单  ä¸»è¡¨ ä¿å­˜
        [Route("Sc_MESBeginStepWorkBill/savrSc_ICMOBillWorkQtyStatus_Tmp")]
        [HttpGet]
        public object savrSc_ICMOBillWorkQtyStatus_Tmp(string HInterID, string HBIllno, string HSourceID, string HQty, string user)
        {
            try
            {
                ds = oCN.RunProcReturn("exec h_p_Sc_ICMOBillWorkQtyStatus_Tmp_Save '" + HBIllno + "','" + HInterID + "','" + HQty + "','" + HSourceID + "','" + user + "'", "h_p_Sc_ICMOBillWorkQtyStatus_Tmp_Save");
                if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存失败";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                objJsonResult.code = "0";
                objJsonResult.count = 1;
                objJsonResult.Message = "保存成功!";
                objJsonResult.data = 1;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "保存失败!" + e.ToString();
                objJsonResult.data = 1;
                return objJsonResult;
            }
        }
        //产量汇报单  å­è¡¨ ä¿å­˜
        [Route("Sc_MESBeginStepWorkBill/savrSc_ICMOBillWorkQtyStatus_Tmp_Sub")]
        [HttpGet]
        public object savrSc_ICMOBillWorkQtyStatus_Tmp_Sub(string HInterID, string HBarCode, string HSourceID, string user)
        {
            try
            {
                ds = oCN.RunProcReturn("exec h_p_Sc_ICMOBillWorkQtyStatus_Tmp_SubSave '" + HBarCode + "','" + HInterID + "','" + HSourceID + "','" + user + "'", "h_p_Sc_ICMOBillWorkQtyStatus_Tmp_SubSave");
                if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存失败";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                ds = oCN.RunProcReturn("select * from Sc_ICMOBillWorkQtyStatus_Tmp_Sub a left join Gy_Material b on a.HMaterID=b.HItemID where HBarCode='"+HBarCode+"'", "Sc_ICMOBillWorkQtyStatus_Tmp_Sub");
                objJsonResult.code = "0";
                objJsonResult.count = 1;
                objJsonResult.Message = "保存成功!";
                objJsonResult.data = ds.Tables[0];
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "保存失败!" + e.ToString();
                objJsonResult.data = 1;
                return objJsonResult;
            }
        }
        #endregion
    }
}