VueWebApi/DLL/DAL/ProductionManagementDAL.cs
@@ -680,7 +680,7 @@
            try
            {
                //获取工艺路线对应工序信息
                sql = @"select A.seq,T.stepcode,T.stepname,T.flwtype,T.descr  from TFlw_Rtdt A
                sql = @"select A.seq,T.stepcode,T.stepname,T.flwtype,T.descr,'0' as stepprice  from TFlw_Rtdt A
                        left join  TStep T on A.step_code=T.stepcode
                        where A.rout_code=@partcode ";
                dynamicParams.Add("@partcode", routecode);
@@ -726,7 +726,7 @@
        #endregion
        #region[工单派发选择工艺路线或选择生产车间时判断绑定条件]
        public static ToMessage SelectRouteOrWkshop(string partcode, string routecode, string wkshopcode)
        public static ToMessage SelectRouteOrWkshop(string partcode, string routecode, string wkshopcode,string is_steprice)
        {
            string sql = "";
            var dynamicParams = new DynamicParameters();
@@ -781,8 +781,10 @@
                        return mes;
                    }
                }
                //判断工艺路线对应工序关联的工作站是否有设置节拍工价
                sql = @"select AA.step_code,AA.eqp_code,AA.flwtype,S.unprice  from (
                if (is_steprice == "Y")
                {
                    //判断工艺路线对应工序关联的工作站是否有设置节拍工价
                    sql = @"select AA.step_code,AA.eqp_code,AA.flwtype,S.unprice  from (
                        select A.code,B.step_code,C.eqp_code,S.flwtype from TFlw_Rout A
                        inner join TFlw_Rtdt B on A.code=B.rout_code
                        left join TFlw_Rteqp C on B.step_code=C.step_code
@@ -791,21 +793,22 @@
                        ) as AA
                        left join (select * from TPrteEqp_Stad   where materiel_code=@partcode and route_code=@route_code and wkspcode=@wkshopcode) as S on
                        AA.code=S.route_code and AA.step_code=S.step_code and AA.eqp_code=S.eqp_code";
                dynamicParams.Add("@partcode", partcode);
                dynamicParams.Add("@route_code", routecode);
                dynamicParams.Add("@wkshopcode", wkshopcode);
                var dtc = DapperHelper.selectdata(sql, dynamicParams);
                for (int i = 0; i < dtc.Rows.Count; i++)
                {
                    if (dtc.Rows[i]["flwtype"].ToString() == "Z") //判断工序是否为自制
                    dynamicParams.Add("@partcode", partcode);
                    dynamicParams.Add("@route_code", routecode);
                    dynamicParams.Add("@wkshopcode", wkshopcode);
                    var dtc = DapperHelper.selectdata(sql, dynamicParams);
                    for (int i = 0; i < dtc.Rows.Count; i++)
                    {
                        if (dtc.Rows[i].IsNull("unprice") || decimal.Parse(dtc.Rows[i]["unprice"].ToString()) == 0)
                        if (dtc.Rows[i]["flwtype"].ToString() == "Z") //判断工序是否为自制
                        {
                            mes.code = "300";
                            mes.count = 0;
                            mes.Message = "节拍工价中:当前产品【" + partcode + "】,对应工艺路线【" + routecode + "】未设置(或未设置全)或工价小于等于0!";
                            mes.data = null;
                            return mes;
                            if (dtc.Rows[i].IsNull("unprice") || decimal.Parse(dtc.Rows[i]["unprice"].ToString()) == 0)
                            {
                                mes.code = "300";
                                mes.count = 0;
                                mes.Message = "节拍工价中:当前产品【" + partcode + "】,对应工艺路线【" + routecode + "】未设置(或未设置全)或工价小于等于0!";
                                mes.data = null;
                                return mes;
                            }
                        }
                    }
                }
@@ -954,21 +957,28 @@
                            CreateDate = DateTime.Now.ToString()
                        }
                    });
                    //写入工单工艺路线工序工价复制表
                    sql = @"insert into TWoPrteEqp_Stad(wo,materiel_code,eqp_code,stand_value,opc_conver,route_code,unprice,eqp_value,cavity_qty,wkspcode,lm_user,lm_date,torg_code,is_delete,step_code)
                           select distinct @mesordercode as wo,S.materiel_code,S.eqp_code,S.stand_value,S.opc_conver,S.route_code,S.unprice,
                           S.eqp_value,S.cavity_qty,S.wkspcode,S.lm_user,S.lm_date,S.torg_code,S.is_delete,S.step_code
                           select distinct @mesordercode as wo,@partcode as  materiel_code,AA.eqp_code,isnull(S.stand_value,0) as stand_value,isnull(S.opc_conver,0) as opc_conver,AA.rout_code,
                           isnull(S.unprice,0) as unprice,isnull(S.eqp_value,0) as eqp_value,isnull(S.cavity_qty,0) as cavity_qty,@wkshopcode as wkspcode,@usercode as lm_user,
                           getdate() as lm_date,S.torg_code,isnull(S.is_delete,0) as is_delete,AA.step_code  from (
                           select  A.rout_code,A.step_code,C.eqp_code
                           from TFlw_Rtdt A
                           inner join TFlw_Rteqp C on A.step_code=C.step_code
                           inner join (select *   from TPrteEqp_Stad  where materiel_code=@materiel_code and route_code=@routecode) as S on C.step_code=S.step_code and C.eqp_code=S.eqp_code";
                           where A.rout_code=@routecode
                           ) as AA
                           left join (select *   from TPrteEqp_Stad  where materiel_code=@partcode and route_code=@routecode) as S on AA.step_code=S.step_code and AA.eqp_code=S.eqp_code";
                    list.Add(new
                    {
                        str = sql,
                        parm = new
                        {
                            mesordercode = mesordercode,
                            materiel_code = partcode,
                            routecode = routecode
                            wkshopcode = wkshopcode,
                            partcode = partcode,
                            routecode = routecode,
                            usercode = username
                        }
                    });
@@ -1076,21 +1086,28 @@
                    });
                    //写入工单工艺路线工序工价复制表
                    sql = @"insert into TWoPrteEqp_Stad(wo,materiel_code,eqp_code,stand_value,opc_conver,route_code,unprice,eqp_value,cavity_qty,wkspcode,lm_user,lm_date,torg_code,is_delete,step_code)
                           select distinct @mesordercode as wo,S.materiel_code,S.eqp_code,S.stand_value,S.opc_conver,S.route_code,S.unprice,
                           S.eqp_value,S.cavity_qty,S.wkspcode,S.lm_user,S.lm_date,S.torg_code,S.is_delete,S.step_code
                           select distinct @mesordercode as wo,@partcode as  materiel_code,AA.eqp_code,isnull(S.stand_value,0) as stand_value,isnull(S.opc_conver,0) as opc_conver,AA.rout_code,
                           isnull(S.unprice,0) as unprice,isnull(S.eqp_value,0) as eqp_value,isnull(S.cavity_qty,0) as cavity_qty,@wkshopcode as wkspcode,@usercode as lm_user,
                           getdate() as lm_date,S.torg_code,isnull(S.is_delete,0) as is_delete,AA.step_code  from (
                           select  A.rout_code,A.step_code,C.eqp_code
                           from TFlw_Rtdt A
                           inner join TFlw_Rteqp C on A.step_code=C.step_code
                           inner join (select *   from TPrteEqp_Stad  where materiel_code=@materiel_code and route_code=@routecode) as S on C.step_code=S.step_code and C.eqp_code=S.eqp_code";
                           where A.rout_code=@routecode
                           ) as AA
                           left join (select *   from TPrteEqp_Stad  where materiel_code=@partcode and route_code=@routecode) as S on AA.step_code=S.step_code and AA.eqp_code=S.eqp_code";
                    list.Add(new
                    {
                        str = sql,
                        parm = new
                        {
                            mesordercode = mesordercode,
                            materiel_code = partcode,
                            routecode = routecode
                            wkshopcode = wkshopcode,
                            partcode = partcode,
                            routecode = routecode,
                            usercode = username
                        }
                    });
                    bool aa = DapperHelper.DoTransaction(list);
                    if (aa)
@@ -2009,9 +2026,18 @@
                dynamicParams.Add("@wo_code", ordercode);
                dynamicParams.Add("@stepcode", stepcode);
                var data = DapperHelper.selectdata(sql, dynamicParams);
                mes.code = "200";
                mes.Message = "查询成功!";
                mes.data = data;
                if (data.Rows.Count > 0)
                {
                    mes.code = "200";
                    mes.Message = "查询成功!";
                    mes.data = data;
                }
                else
                {
                    mes.code = "300";
                    mes.Message = "当前工序未关联生产设备!";
                    mes.data = null;
                }
            }
            catch (Exception e)
            {