구매수량없이 구매신청되지 않게 함

This commit is contained in:
chi
2024-02-08 09:49:47 +09:00
parent 283597f612
commit 3691bee8a9
17 changed files with 3146 additions and 941 deletions

View File

@@ -184,8 +184,24 @@ namespace FCOMMON
" from EETGW_PurchaseCR" +
" where gcode = @gcode and state <> 'Cancled'" +
" and projectidx = @project" +
(sid == null ? string.Empty : " and sid = @sid") +
(sid == null ? string.Empty : " and sid = @sid") +
" and isnull(isdel,0) = 0" +
" union all" +
" select " +
" isnull(sum(case when[state] = 'PR' then 0 when[state] = 'PO' then 0 when[state] = 'Received' then 0 when[state] = 'Cancled' then 0 else pumqtyreq end),0) as Request," +
" isnull(sum(case when[state] = 'PR' then pumqty else 0 end),0) as PR," +
" isnull(sum(case when[state] = 'PO' then pumqty else 0 end),0) as PO," +
" isnull(sum(case when[state] = 'Received' then inqty else 0 end),0) as Received," +
" isnull(sum(isnull(pumqty,pumqtyreq)),0) as Total_Request," +
" isnull(sum(inqty),0) as Total_Buy," +
" isnull(sum(isnull(pumqty,pumqtyreq)) - sum(inqty),0) as Total_Remain" +
" from Purchase" +
" where gcode = @gcode and state <> 'Cancled'" +
" and projectidx = @project" +
(sid == null ? string.Empty : " and sid = @sid") +
" and isnull(isdel,0) = 0";
var cn = getCn();
var cmd = new SqlCommand(sql, cn);
cmd.Parameters.Add("gcode", System.Data.SqlDbType.VarChar).Value = FCOMMON.info.Login.gcode;
@@ -208,14 +224,14 @@ namespace FCOMMON
var o_totalbuy = rdr["Total_Buy"];
var o_totalremain = rdr["Total_Remain"];
if (o_request != null) retval.Request = int.Parse(o_request.ToString());
if (o_pr != null) retval.PR = int.Parse(o_pr.ToString());
if (o_po != null) retval.PO = int.Parse(o_po.ToString());
if (o_received != null) retval.Received = int.Parse(o_received.ToString());
if (o_request != null) retval.Request += int.Parse(o_request.ToString());
if (o_pr != null) retval.PR += int.Parse(o_pr.ToString());
if (o_po != null) retval.PO += int.Parse(o_po.ToString());
if (o_received != null) retval.Received += int.Parse(o_received.ToString());
//if (o_cancled != null) retval.Cancled = int.Parse(o_cancled.ToString());
if (o_totalrequest != null) retval.Total_Request = int.Parse(o_totalrequest.ToString());
if (o_totalbuy != null) retval.Total_Ipko = int.Parse(o_totalbuy.ToString());
if (o_totalremain != null) retval.Total_Remain = int.Parse(o_totalremain.ToString());
if (o_totalrequest != null) retval.Total_Request += int.Parse(o_totalrequest.ToString());
if (o_totalbuy != null) retval.Total_Ipko += int.Parse(o_totalbuy.ToString());
if (o_totalremain != null) retval.Total_Remain += int.Parse(o_totalremain.ToString());
}
rdr.Close();
cn.Dispose();