yusijie
2023-05-05 eefde4f588fbcf5373baf98449246236649a8c39
Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API
2个文件已修改
394 ■■■■■ 已修改文件
WebAPI/Controllers/CJGL/Mes_OrderProcFlowAllReportController.cs 196 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/生产管理/生产任务单/Sc_ICMOBillController.cs 198 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/CJGL/Mes_OrderProcFlowAllReportController.cs
@@ -130,7 +130,8 @@
        }
        #endregion
        #region ä¸è‰¯æ˜Žç»†è‰¯çŽ‡æŠ¥è¡¨ æŸ¥è¯¢
        #region è½¦é—´ç”Ÿäº§æ±‡æŠ¥ç»Ÿè®¡è¡¨ æŸ¥è¯¢
        [Route("Mes_OrderProcFlowAllReport/StationOutSumReportList")]
        [HttpGet]
        public object StationOutSumReportList(string sWhere)
@@ -166,5 +167,198 @@
            }
        }
        #endregion
        #region è®¡ä»¶å·¥èµ„报表 æŸ¥è¯¢
        [Route("Mes_OrderProcFlowAllReport/EmployeePiecePayReport")]
        [HttpGet]
        public object EmployeePiecePayReport(string sWhere)
        {
            try
            {
                //反序列化传递的值
                ds = oCN.RunProcReturn("exec h_p_Sc_EmployeePiecePayReport " + sWhere + "", "h_p_Sc_EmployeePiecePayReport");
                List<object> listCol = new List<object>();
                foreach (DataColumn col in ds.Tables[0].Columns)
                {
                    Type dataType = col.DataType;
                    string str = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                    listCol.Add(JsonConvert.DeserializeObject(str));
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                objJsonResult.list = listCol;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region è®¡ä»¶å·¥èµ„汇总报表 æŸ¥è¯¢
        [Route("Mes_OrderProcFlowAllReport/EmployeePiecePaySumReport")]
        [HttpGet]
        public object EmployeePiecePaySumReport(string sWhere)
        {
            try
            {
                //反序列化传递的值
                ds = oCN.RunProcReturn("exec h_p_Sc_EmployeePiecePaySumReport " + sWhere + "", "h_p_Sc_EmployeePiecePaySumReport");
                List<object> listCol = new List<object>();
                foreach (DataColumn col in ds.Tables[0].Columns)
                {
                    Type dataType = col.DataType;
                    string str = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                    listCol.Add(JsonConvert.DeserializeObject(str));
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                objJsonResult.list = listCol;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region å·¥èµ„汇报日报表 æŸ¥è¯¢
        [Route("Mes_OrderProcFlowAllReport/EmployeePieceWorkReport")]
        [HttpGet]
        public object EmployeePieceWorkReport(string sWhere)
        {
            try
            {
                //反序列化传递的值
                ds = oCN.RunProcReturn("exec h_p_Sc_EmployeePieceWorkReport " + sWhere + "", "h_p_Sc_EmployeePieceWorkReport");
                List<object> listCol = new List<object>();
                foreach (DataColumn col in ds.Tables[0].Columns)
                {
                    Type dataType = col.DataType;
                    string str = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                    listCol.Add(JsonConvert.DeserializeObject(str));
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                objJsonResult.list = listCol;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region ç”Ÿäº§è½¦é—´å·¥åºæŠ¥è¡¨ æŸ¥è¯¢
        [Route("Mes_OrderProcFlowAllReport/WorkShopProcessWIPReport")]
        [HttpGet]
        public object WorkShopProcessWIPReport(string sWhere)
        {
            try
            {
                //反序列化传递的值
                ds = oCN.RunProcReturn("exec h_p_Sc_WorkShopProcessWIPReport " + sWhere + "", "h_p_Sc_WorkShopProcessWIPReport");
                List<object> listCol = new List<object>();
                foreach (DataColumn col in ds.Tables[0].Columns)
                {
                    Type dataType = col.DataType;
                    string str = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                    listCol.Add(JsonConvert.DeserializeObject(str));
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                objJsonResult.list = listCol;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region å·¥åºåœ¨åˆ¶å“æŠ¥è¡¨ æŸ¥è¯¢
        [Route("Mes_OrderProcFlowAllReport/WorkShopProcessWIPSumReport")]
        [HttpGet]
        public object WorkShopProcessWIPSumReport(string sWhere)
        {
            try
            {
                //反序列化传递的值
                ds = oCN.RunProcReturn("exec h_p_Sc_WorkShopProcessWIPSumReport " + sWhere + "", "h_p_Sc_WorkShopProcessWIPSumReport");
                List<object> listCol = new List<object>();
                foreach (DataColumn col in ds.Tables[0].Columns)
                {
                    Type dataType = col.DataType;
                    string str = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                    listCol.Add(JsonConvert.DeserializeObject(str));
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                objJsonResult.list = listCol;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
    }
}
WebAPI/Controllers/Éú²ú¹ÜÀí/Éú²úÈÎÎñµ¥/Sc_ICMOBillController.cs
@@ -873,6 +873,204 @@
        }
        #endregion
        #region ç”Ÿäº§ä»»åŠ¡å• å¤šè¡Œæ‰¹é‡ä¸‹æŽ¨
        [Route("Sc_ICMOBill/Sc_ICMOReportBill_dh")]
        [HttpGet]
        public object Sc_ICMOReportBill_dh(string HInterID, string user, int OrganizationID)
        {
            try
            {
                //获取单据ID
                string[] HBillNo = HInterID.Split(',');
                string Error = "";
                int i = 0;
                foreach (var item in HBillNo)
                {
                    string err = "";
                    DAL.ClsSc_ProcessExchangeBill oBill = new DAL.ClsSc_ProcessExchangeBill();
                    Model.ClsSc_ProcessExchangeBillMain lsmain = new Model.ClsSc_ProcessExchangeBillMain();
                    List<Model.ClsSc_ProcessExchangeBillSub> ls = new List<Model.ClsSc_ProcessExchangeBillSub>();
                    string HBillNOs = "";
                    string hmainid = item.Split('|')[0];
                    string HEntryID = item.Split('|')[1];
                    ds = oCN.RunProcReturn("select * from h_v_IF_ICMOBillList where 1 = 1  and hmainid=" + hmainid + " and  HEntryID=" + HEntryID + " order by å•据号 desc", "h_v_IF_ICMOBillList");
                    if (ds.Tables[0].Rows.Count == 0)
                    {
                        err = "无数据! \n";
                    }
                    else
                    {
                        string HNumber = ds.Tables[0].Rows[0]["产品代码"].ToString();
                        HBillNOs = ds.Tables[0].Rows[0]["单据号"].ToString();
                        if (ds.Tables[0].Rows[0]["审核人"].ToString() == "")
                        {
                            err = "所选生产订单为未审核状态,不允许下推生成工序流转卡!\n";
                        }
                        if (ds.Tables[0].Rows[0]["关闭人"].ToString() != "")
                        {
                            err = "所选生产订单为已关闭状态,不允许下推生成工序流转卡!\n";
                        }
                        if (ds.Tables[0].Rows[0]["作废人"].ToString() != "")
                        {
                            err = "所选生产订单为已作废状态,不允许下推生成工序流转卡!\n";
                        }
                        ds = oCN.RunProcReturn("select * from h_v_S_Sc_ICMOBillList where hmainid=" + hmainid + " and HEntryID=" + HEntryID + " and HSTOCKINORGID='" + OrganizationID + "'", "h_v_S_Sc_ICMOBillList");
                        if (double.Parse(ds.Tables[0].Rows[0]["流转卡数量"].ToString()) == 0)
                        {
                            err = "所选生产订单已全部下推生成工序流转卡,剩余可下推数量为0,不允许下推生成工序流转卡!\n";
                        }
                        lsmain.HMaker = user;  //制单人
                        lsmain.HBillType = "3772";
                        lsmain.HBillSubType = "3772";
                        lsmain.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));
                        lsmain.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
                        lsmain.HPeriod = DBUtility.ClsPub.isLong(DateTime.Now.Month);
                        lsmain.HICMOInterID = long.Parse(ds.Tables[0].Rows[0]["hmainid"].ToString());
                        lsmain.HICMOBillNo = ds.Tables[0].Rows[0]["生产订单号"].ToString();
                        lsmain.HICMOEntryID = long.Parse(ds.Tables[0].Rows[0]["HEntryID"].ToString());
                        lsmain.HOrderProcNO = ds.Tables[0].Rows[0]["订单跟踪号"].ToString();
                        lsmain.HMaterID = long.Parse(ds.Tables[0].Rows[0]["hmaterid"].ToString());
                        lsmain.HMaterID2 = long.Parse(ds.Tables[0].Rows[0]["hmaterid"].ToString());
                        lsmain.HMaterNumber = ds.Tables[0].Rows[0]["物料代码"].ToString();
                        lsmain.HMaterModel = ds.Tables[0].Rows[0]["规格型号"].ToString();
                        lsmain.HBatchNo = ds.Tables[0].Rows[0]["批号"].ToString();
                        lsmain.HSplitNo =1;//都是1
                        lsmain.HUnitID = long.Parse(ds.Tables[0].Rows[0]["hunitid"].ToString());
                        lsmain.HUnitNumber = ds.Tables[0].Rows[0]["计量单位代码"].ToString();
                        lsmain.HPlanQty = double.Parse(ds.Tables[0].Rows[0]["计划生产数量"].ToString());
                        lsmain.HQty = double.Parse(ds.Tables[0].Rows[0]["流转卡数量"].ToString());
                        lsmain.HPlanBeginDate = DateTime.Parse(ds.Tables[0].Rows[0]["计划开工日期"].ToString());
                        lsmain.HPlanEndDate = DateTime.Parse(ds.Tables[0].Rows[0]["计划完工日期"].ToString());
                        lsmain.HWorkShopID = long.Parse(ds.Tables[0].Rows[0]["hdeptid"].ToString());
                        lsmain.HProdMaterCode = ds.Tables[0].Rows[0]["产品CODE"].ToString();
                        lsmain.HSeOrderBillNo = ds.Tables[0].Rows[0]["销售订单号"].ToString();
                        lsmain.HCusShortName = ds.Tables[0].Rows[0]["客户简称"].ToString();
                        lsmain.HCusNeedMaterial = ds.Tables[0].Rows[0]["客户要求材料成分"].ToString();
                        lsmain.HPlanSendGoodsDate = ds.Tables[0].Rows[0]["预计出货日期"].ToString()==""?DateTime.Now.ToString(): ds.Tables[0].Rows[0]["预计出货日期"].ToString();
                        lsmain.HSellDate = DateTime.Now.ToString();
                        lsmain.HPRDORGID = OrganizationID;
                        lsmain.HProdMaterName = ds.Tables[0].Rows[0]["产品名称"].ToString();
                        lsmain.HCusName = ds.Tables[0].Rows[0]["客户名称"].ToString();
                        lsmain.HWorkRemark = ds.Tables[0].Rows[0]["生产备注"].ToString();
                        lsmain.HImportNote = ds.Tables[0].Rows[0]["重要提示"].ToString();
                        lsmain.HPicNumVer = ds.Tables[0].Rows[0]["图号版本"].ToString();
                        lsmain.HPicNumAssemble = ds.Tables[0].Rows[0]["总装图号"].ToString();
                        lsmain.HMaterTexture = ds.Tables[0].Rows[0]["材质"].ToString();
                        lsmain.HProductNum = ds.Tables[0].Rows[0]["成品编号"].ToString();
                        lsmain.HVerNum = ds.Tables[0].Rows[0]["版本"].ToString();
                        //lsmain.HCusNumber = ds.Tables[0].Rows[0]["源单客户编码"].ToString();
                        //lsmain.HPickLabel = ds.Tables[0].Rows[0]["包装标识"].ToString();
                        //lsmain.HPickLabelNumber = ds.Tables[0].Rows[0]["包装标识编码"].ToString();
                        //lsmain.HXTNumber = ds.Tables[0].Rows[0]["芯体物料代码"].ToString();
                        //lsmain.HXTModel = ds.Tables[0].Rows[0]["芯体规格型号"].ToString();
                        lsmain.HWidth = double.Parse(ds.Tables[0].Rows[0]["HWidth"].ToString());
                        lsmain.HWeight = double.Parse(ds.Tables[0].Rows[0]["HWeight"].ToString());
                        lsmain.HAuxUnit = int.Parse(ds.Tables[0].Rows[0]["HAuxUnit"].ToString());
                        lsmain.HRemark2 = ds.Tables[0].Rows[0]["备注"].ToString();
                        lsmain.HEmpID = long.Parse(ds.Tables[0].Rows[0]["HEmpID"].ToString());
                        lsmain.HCusID = long.Parse(ds.Tables[0].Rows[0]["HCusID"].ToString());
                        lsmain.HColorRemark = ds.Tables[0].Rows[0]["染色要求"].ToString();
                        lsmain.HBLFlag = ds.Tables[0].Rows[0]["HBLFlag"].ToString() == "0" ? false : true;
                        lsmain.HAuxQty = 0;
                        lsmain.HAuxUnit = 0;
                        ds = oCN.RunProcReturn("select top 1000 * from h_v_Gy_RoutingBillList a left join Gy_Process p on a.hprocid = p.HItemID where ç‰©æ–™ä»£ç ='" + HNumber + "' and é»˜è®¤å·¥è‰º=1", "h_v_Gy_RoutingBillList");
                        if (ds.Tables[0].Rows.Count == 0)
                        {
                            err = "所选生产订单对应物料未设置对应的工艺路线,不允许下推生成工序流转卡!\n";
                        }
                        else
                        {
                            lsmain.HRoutingBillID = ds.Tables[0].Rows[0]["hmainid"].ToString();
                            oBill.omodel = lsmain;
                            int j = 0;
                            foreach (DataRow row in ds.Tables[0].Rows)
                            {
                                if (row["HTProcessFlag"].ToString() == "False")
                                {
                                    ClsSc_ProcessExchangeBillSub sub = new ClsSc_ProcessExchangeBillSub();
                                    sub.HEntryID = j + 1;
                                    sub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
                                    sub.HProcNo = long.Parse(row["工序号"].ToString());
                                    sub.HProcID = long.Parse(row["HProcID"].ToString());
                                    sub.HProcNumber = row["工序代码"].ToString();
                                    sub.HWorkRemark = row["表体备注"].ToString();
                                    sub.HCenterID = long.Parse(row["HCenterID"].ToString());
                                    sub.HSupID = long.Parse(row["HSupID"].ToString());
                                    sub.HSupFlag = row["委外标记"].ToString() == "False" ? false : true;
                                    sub.HQty = lsmain.HQty;
                                    sub.HTechnologyParameter = row["工艺参数"].ToString();
                                    sub.HPicNum = row["图纸编号"].ToString();
                                    sub.HProcCheckNote = row["本工序确认记录"].ToString();
                                    sub.HDeptID = 0;
                                    sub.HDeptNumber = "";
                                    sub.HOutPrice = 0;
                                    sub.HRemark = "";
                                    sub.HRelationQty_In =0;
                                    sub.HRelationQty_Out = 0;
                                    sub.HRelationQty_WWOrder = 0;
                                    sub.HRelationQty_Bad = 0;
                                    sub.HOverRate = 0;
                                    sub.HMaxQty = 0;
                                    sub.HPassRate = 0;
                                    sub.HSumPassRate = 0;
                                    j++;
                                    oBill.DetailColl.Add(sub);
                                }
                            }
                        }
                    }
                    bool bResult = false;
                    if (err != "")
                    {
                        Error += "生产订单单据号:" + HBillNOs + "\n" + err;
                    }
                    else
                    {
                        oBill.omodel.HBillNo = DBUtility.ClsPub.CreateBillCode("3772", ref DBUtility.ClsPub.sExeReturnInfo,true);
                        bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                        oBill.DetailColl.Clear();
                        if (!bResult)
                        {
                            Error += "保存失败,生产订单单据号:" + HBillNOs + "\n" + err;
                        }
                        else
                        {
                            i++;
                        }
                    }
                }
                Error = "成功:" + i + "行  !!!    " + Error;
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = Error;
                objJsonResult.data = null;
                return objJsonResult; ;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "下推失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region ç”Ÿäº§ä»»åŠ¡å•èŽ·å–è½¦é—´
        [Route("Sc_ICMOBill/GetHDeptList")]
        [HttpGet]