diff --git a/WEB-INF/conf/sysds_mms.xml b/WEB-INF/conf/sysds_mms.xml index 50febbb..a028421 100644 --- a/WEB-INF/conf/sysds_mms.xml +++ b/WEB-INF/conf/sysds_mms.xml @@ -1236,7 +1236,7 @@ select a.PKEY,a.DBSQPKEY,a.DJH,a.XH,a.SFX_BM,a.KSKC_PC_PKEY,a.SL,a.SJDBSL,a.DW,a select a.PKEY,a.DBDPKEY,a.DJH,a.XH,a.SFX_BM,a.KSKC_PC_PKEY,a.DBSQMX_PKEY,a.SL,a.DW,a.DJ,a.SJ,a.JE,a.SJJE,a.CJR,a.CJRQ,a.XGR,a.XGRQ,a.JGID,a.LOCKFLAG,b.MC,b.JBDW,b.RKDW,b.ZHXS,b.JG,b.JBJG,c.KYSL,c.PH,c.KSKC_PKEY,c.YXQ, - b.DWVIEW,sq.SL SQSL,sq.SJDBSL,sq.DW SQDW,c.DJ PCDJ,c.JBDJ PCJBDJ,c.SJ PCSJ,c.JBSJ PCJBSJ,y.WZCS,y.WZGG,b.ybbm,b.ybmc + b.DWVIEW,sq.SL SQSL,sq.SJDBSL,sq.DW SQDW,c.DJ PCDJ,c.JBDJ PCJBDJ,c.SJ PCSJ,c.JBSJ PCJBSJ,y.WZCS,y.WZGG,b.ybbm,b.ybmc,c.FIRST_KSKC_PC_PKEY from HIS_MMS_KC_DBD_MX a left join HIS_SFX b on a.JGID=b.JGID and a.SFX_BM=b.BM left join HIS_KSKC_PC c on a.JGID=c.JGID and c.PKEY=a.KSKC_PC_PKEY @@ -1293,7 +1293,8 @@ select a.PKEY,a.DBDPKEY,a.DJH,a.XH,a.SFX_BM,a.KSKC_PC_PKEY,a.DBSQMX_PKEY,a.SL,a. - + +

12

@@ -3280,7 +3281,7 @@ select a.PKEY,a.RKDPKEY,a.DJH,a.DPTID,a.XH,a.SFX_BM,a.KSKC_PC_PKEY,a.PH,a.YXQ,a. left join HIS_SFX b on a.JGID=b.JGID and a.SFX_BM=b.BM left join HIS_MMS_WZZD c on c.WZBM=b.BM left join HIS_MMS_KC_RKD d on a.JGID=d.JGID and a.DJH=d.DJH - left join HIS_KSKC_PC e on a.JGID=e.JGID and e.PKEY=a.KSKC_PC_PKEY + left join HIS_KSKC_PC e on a.JGID=e.JGID and (e.FIRST_KSKC_PC_PKEY=a.KSKC_PC_PKEY or e.PKEY=a.KSKC_PC_PKEY ) left join HIS_KSKC f on e.JGID=f.JGID and e.KSKC_PKEY=f.pkey where a.JGID=? and f.DPTID=? and b.GLLX='W' and d.WZLZ=? and d.GYS=? and e.KYSL>0 and (b.BM like ? or b.MC like ? or EXISTS (SELECT 1 FROM HIS_SFX_ZJM z WHERE z.SFX_BM = b.BM and z.JGID=b.JGID and z.PYM like ?)) diff --git a/WEB-INF/src/com/mms/service/MMSdbService.java b/WEB-INF/src/com/mms/service/MMSdbService.java index dec5f03..52362d9 100644 --- a/WEB-INF/src/com/mms/service/MMSdbService.java +++ b/WEB-INF/src/com/mms/service/MMSdbService.java @@ -7,9 +7,7 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; - import com.his.util.HisYfykUtil; -import com.his.yfyk.model.YpdbModel; import com.his.yfyk.service.YkService; import com.his.yfyk.service.YpdbService; import com.mms.model.MMSdbModel; @@ -467,6 +465,7 @@ public class MMSdbService { String ph=mmsdbdmxdao.getColumnValueAsString(i,"PH"); String dw=mmsdbdmxdao.getColumnValueAsString(i,"DW"); String kskcpcpkey=mmsdbdmxdao.getColumnValueAsString(i,"KSKC_PC_PKEY"); + String first_kskc_pc_pkey=mmsdbdmxdao.getColumnValueAsString(i,"FIRST_KSKC_PC_PKEY"); String sl=mmsdbdmxdao.getColumnValueAsString(i,"SL"); String jbdw=mmsdbdmxdao.getColumnValueAsString(i,"JBDW"); String zhxs=mmsdbdmxdao.getColumnValueAsString(i,"ZHXS"); @@ -514,6 +513,10 @@ public class MMSdbService { hiskskcpcdao.absolute(hiskskcpcdao.insert(hiskskcpcdao.getRowCount())); hiskskcpcdao.setColumnValue("PKEY", SnowIdUtils.uniqueLong()); hiskskcpcdao.setColumnValue("YSPKEY", kskcpcpkey);//这里引用以前入库单的批次库存主键,这样保证退货的时候,能够通过入库单关联调拨后的药品 + if(Delphi.isNullString(first_kskc_pc_pkey)) { + first_kskc_pc_pkey = kskcpcpkey; + } + hiskskcpcdao.setColumnValue("FIRST_KSKC_PC_PKEY", first_kskc_pc_pkey);//这里是最原始的入库单对应的库存批次的批次主键 hiskskcpcdao.setColumnValue("JGID", jgid); hiskskcpcdao.setColumnValue("KSKC_PKEY", kskcpkey2); hiskskcpcdao.setColumnValue("PH", ph);